{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {},
   "outputs": [],
   "source": [
    "import_and_maybe_install <- function(pkgs){\n",
    "    missing_packages <- character(0)\n",
    "    for(pkg in pkgs){\n",
    "        tryCatch({\n",
    "            require(pkg, character.only=TRUE )\n",
    "        },warning=function(err){\n",
    "            missing_packages <<- c(missing_packages,pkg)\n",
    "        })\n",
    "    }\n",
    "    if(length(missing_packages)){\n",
    "            install.packages(missing_packages)\n",
    "            sapply(missing_packages, require, character.only=TRUE)\n",
    "    }\n",
    "    invisible(NULL)\n",
    "}\n",
    "import_and_maybe_install(c(\"data.table\", \"feather\", \"ggplot2\",\"clusterSEs\"))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {},
   "outputs": [],
   "source": [
    "DATA_DIR <- \"~/connector/20200226/analytic_datasets\"\n",
    "\n",
    "# inclues all stops: morning and evening commutes\n",
    "ride_date_commute_counts <- read_feather( file.path(DATA_DIR,\"ride_date_commute_counts.feather\"))\n",
    "setDT(ride_date_commute_counts)\n",
    "\n",
    "# just the first stop in the morning:\n",
    "ride_date_first_counts <- read_feather(file.path(DATA_DIR,\"ride_date_first_counts.feather\"))\n",
    "setDT(ride_date_first_counts)\n",
    "\n",
    "# just the first stop in the morning:\n",
    "ride_date_last_counts <- read_feather(file.path(DATA_DIR,\"ride_date_last_counts.feather\"))\n",
    "setDT(ride_date_last_counts)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [],
   "source": [
    "# DATSETS WITH COUNTS BROKEN DOWN BY PEAK / NON-PEAK\n",
    "\n",
    "# inclues all stops: morning and evening commutes\n",
    "ride_date_commute_counts_peak <- read_feather( file.path(DATA_DIR,\"ride_date_commute_counts_peak.feather\"))\n",
    "setDT(ride_date_commute_counts_peak)\n",
    "\n",
    "# just the first stop in the morning:\n",
    "ride_date_first_counts_peak <- read_feather(file.path(DATA_DIR,\"ride_date_first_counts_peak.feather\"))\n",
    "setDT(ride_date_first_counts_peak)\n",
    "\n",
    "# just the first stop in the morning:\n",
    "ride_date_last_counts_peak <- read_feather(file.path(DATA_DIR,\"ride_date_last_counts_peak.feather\"))\n",
    "setDT(ride_date_last_counts_peak)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Data Dictionary\n",
    "\n",
    "Each record represents one route / date / commute (AM vs PM)\n",
    "\n",
    "* **RouteId**: Route Number\n",
    "* **fRoute**: Route Number (as Factor)\n",
    "* **IsESOther**: East Side (Other)\n",
    "* **IsSuburban**: Suburban Route\n",
    "* **IsRouteSeattle**: Is a Seattle Route\n",
    "* **Is405North**: Is a 405 North Route\n",
    "* **IsOneStop**: Is a single Stop Route\n",
    "* **IsCoach**: Is a coach Route\n",
    "* **DateId**: Date Code (1 - 232)\n",
    "* **SR520WBHOV**: SR 520 West Bound is open (Function of the date)\n",
    "* **SR520EBHOV**: SR 520 East Bound is open (Function of the date)\n",
    "* **I405HOV**: Is a 405 HOV is open (Function of the date )\n",
    "* **Route5Expansion**: Route 5 expanded (Function of Date )\n",
    "* **AfternoonId**: Function of Date, only true for Route 5\n",
    "* **new_fraction_10day**: Rolling fraction of busses which are new on a route\n",
    "        weighted by number of riders. E.g. if the first bus is old and has 10 people\n",
    "        and the last bus is new and has 30 people, the route is 3/4 new (over those\n",
    "        rides)\n",
    "* **at_or_over_capacity_10day**: Rolling fraction of busses which are at or over capacity\n",
    "        weighted by number of riders (ya, lots to complain about this variable)\n",
    "* **over_capacity_10day**: Rolling fraction of busses which are over capacity\n",
    "        weighted by number of riders (ya, lots to complain about this variable)\n",
    "* **Ridership**: Count of the riders\n",
    "* **date**: Date of the ride (as Date)\n",
    "* **fDate**: Date of the ride (as Factor)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## A Handy Utility function for fitting models and gathering summary statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "metadata": {},
   "outputs": [],
   "source": [
    "#' A cute little function for fitting a model and pulling out the headline statistics\n",
    "#'\n",
    "#' @param data A dataset for fitting the model\n",
    "#' @param model A number for identifying the model in a table (these second field in the \"coef\" output)\n",
    "#' @param seed The seed to set before calculating the Bootstrap standard errors (10101 is my lucky seed)\n",
    "#' @param lhs The left hand side of the model (as a string)\n",
    "#' @param random The random effects in the model.  Specifically these are the effects that will be pulled out in the summary table\n",
    "#' @param fixed The fixed effects that will be included in the right hand side but not pulled out into the summar table\n",
    "#'\n",
    "#' @return A list containing the glm model (`$model`), the return value from\n",
    "#'       `cluster.wild.glm` (`$cl`), and a matrix of interesting statistics from the\n",
    "#'       various models (`$coef`)\n",
    "fit_ridership_counts_models <- function(data,\n",
    "                                        model=1,\n",
    "                                        seed=10101,\n",
    "                                        lhs=\"log(Ridership)\",\n",
    "                                        random=\"new_fraction_10day\",\n",
    "                                        fixed=c(\"fDate\", # up to 231 levels\n",
    "                                                \"fRoute\" # \n",
    "                                               ),\n",
    "                                        quick=FALSE,\n",
    "                                       granularity=\"\"){\n",
    "\n",
    "    # FIT THE OLS MODELS\n",
    "    fmla <- formula(paste(lhs,'~',paste(c(random,fixed),collapse=' + ')))\n",
    "    fmla <- update(fmla,~.) # this is required so that we can catch the re-ordering early\n",
    "    .lm0 <- lm(fmla, data = data) # Useful for extracting the R-squared value\n",
    "    .lm <- glm(fmla, data = data) # required for the wild bootstrap\n",
    "    \n",
    "    # SUMMARY OF THE OLS MODEL\n",
    "    cat(\"\\n===============================================\\n\")\n",
    "    cat(\"Model \",model,\":\")\n",
    "    cat(\"\\n===============================================\\n\")\n",
    "    print(fmla)\n",
    "    cat(\"\\n\\nCoefficients from Linear model (Fixed effects omitted):\\n\")\n",
    "    \n",
    "    # catch the re-ordering of interaction terms introduced by the update(form,dev.new ~ .) call in cluster.wild.glm\n",
    "    tryCatch({\n",
    "        print(coef(summary(.lm))[c(\"(Intercept)\",random),])    \n",
    "    },error = function(err){\n",
    "        model_coef = dimnames(coef(summary(.lm)))[[1]]\n",
    "        cat(\"Missing coefficients:\\n\",\n",
    "            random[! random %in% model_coef])\n",
    "        cat(\"\\n\\nAvailable coefficients:\\n\")\n",
    "        \n",
    "        print(model_coef)\n",
    "        print(err)\n",
    "    })\n",
    "    \n",
    "    if(quick){\n",
    "        # MAKE THE PRETTY OUTPUT\n",
    "        # without doing the (slow) wild bootstrap\n",
    "        out = cbind(model=model,\n",
    "                                \"OLS Estimate\"=coef(summary(.lm))[random,\"Estimate\"],\n",
    "                                \"OLS Estimate (%)\" = (exp(coef(summary(.lm))[random,\"Estimate\"]) - 1 ) * 100,\n",
    "                                \"OLS p-value\"=coef(summary(.lm))[random,\"Pr(>|t|)\"],\n",
    "                                N=data[,.N],\n",
    "                                r2= summary(.lm0)$r.squared,\n",
    "                                granularity=granularity)\n",
    "        dimnames(out)[[1]] <- random\n",
    "        return(list( model=.lm, coef=out))\n",
    "    }\n",
    "    \n",
    "    # DO THE WILD BOOTSTRAP\n",
    "    set.seed(seed)\n",
    "    cl <-cluster.wild.glm(.lm, dat = data,cluster = ~ factor(RouteId), boot.reps = 1001,report=FALSE)\n",
    "             \n",
    "    \n",
    "    # MAKE THE PRETTY OUTPUT\n",
    "    CI = rbind(cl$ci[random,])\n",
    "    CI_p = (exp(CI) - 1) * 100\n",
    "    dimnames(CI_p)[[2]] <- paste(dimnames(CI)[[2]],\"(%)\")\n",
    "\n",
    "    out <- cbind(model=model,\n",
    "                        \"OLS Estimate\"=coef(summary(.lm))[random,\"Estimate\"],\n",
    "                        \"OLS Estimate (%)\" = (exp(coef(summary(.lm))[random,\"Estimate\"]) - 1 ) * 100,\n",
    "                        \"OLS p-value\"=coef(summary(.lm))[random,\"Pr(>|t|)\"],\n",
    "                        \"BS p-value\"=cl$p.values[random,],\n",
    "                        CI,CI_p,\n",
    "                        N=data[,.N],\n",
    "                        r2= summary(.lm0)$r.squared,\n",
    "                        granularity=granularity)\n",
    "    dimnames(out)[[1]] <- random\n",
    "    \n",
    "    return(list( model=.lm, cluster=cl, coef=out))\n",
    "} "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Fit the Models for table 2\n",
    "* 2015 data only"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "===============================================\n",
      "Model  1 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + fDate + fRoute\n",
      "<environment: 0x000000003083c328>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                     Estimate Std. Error    t value     Pr(>|t|)\n",
      "(Intercept)        4.59435019 0.03696504 124.289076 0.000000e+00\n",
      "new_fraction_10day 0.06865143 0.01683259   4.078484 4.649014e-05\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  2 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + new_fraction_10day:IsRouteSeattle + \n",
      "    fDate + fRoute\n",
      "<environment: 0x000000002b3306e8>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                                     Estimate Std. Error    t value\n",
      "(Intercept)                        4.60639249 0.03737121 123.260467\n",
      "new_fraction_10day                 0.09488361 0.02082884   4.555396\n",
      "new_fraction_10day:IsRouteSeattle -0.04959892 0.02322144  -2.135911\n",
      "                                      Pr(>|t|)\n",
      "(Intercept)                       0.000000e+00\n",
      "new_fraction_10day                5.433844e-06\n",
      "new_fraction_10day:IsRouteSeattle 3.276614e-02\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  3 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + new_fraction_10day:IsRouteSeattle + \n",
      "    fDate + fRoute\n",
      "<environment: 0x000000002a405b68>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                                      Estimate Std. Error    t value   Pr(>|t|)\n",
      "(Intercept)                        3.861073599 0.06219436 62.0807652 0.00000000\n",
      "new_fraction_10day                -0.080682065 0.04171902 -1.9339398 0.05339342\n",
      "new_fraction_10day:IsRouteSeattle -0.005082066 0.04166672 -0.1219694 0.90294694\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  4 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + new_fraction_10day:IsRouteSeattle + \n",
      "    fDate + fRoute\n",
      "<environment: 0x00000000717d2098>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                                     Estimate Std. Error  t value   Pr(>|t|)\n",
      "(Intercept)                        3.51481809 0.05707713 61.58014 0.00000000\n",
      "new_fraction_10day                -0.09069071 0.03782467 -2.39766 0.01669034\n",
      "new_fraction_10day:IsRouteSeattle  0.09045343 0.03663283  2.46919 0.01371504\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  5 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + fDate + fRoute\n",
      "<environment: 0x0000000066a60318>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                     Estimate Std. Error     t value  Pr(>|t|)\n",
      "(Intercept)        4.63328348 0.03661919 126.5260933 0.0000000\n",
      "new_fraction_10day 0.01415175 0.01703800   0.8305992 0.4063402\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  6 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + fDate + fRoute\n",
      "<environment: 0x000000008e1eaea0>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                    Estimate Std. Error   t value     Pr(>|t|)\n",
      "(Intercept)        3.5827103 0.05749511 62.313310 0.000000e+00\n",
      "new_fraction_10day 0.1531085 0.02994144  5.113598 3.551534e-07\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n"
     ]
    }
   ],
   "source": [
    "TABLE_2_MODELS_2015 <- list(\n",
    "    \n",
    "        M1 = fit_ridership_counts_models(data = ride_date_commute_counts[year(date) == 2015],\n",
    "                                    random=c(\"new_fraction_10day\"),\n",
    "                                    model=1,\n",
    "                                    granularity=\"ride/date/commute\"),\n",
    "    \n",
    "        M2 = fit_ridership_counts_models(data = ride_date_commute_counts[year(date) == 2015],\n",
    "                                    random=c(\"new_fraction_10day\",\"new_fraction_10day:IsRouteSeattle\"),\n",
    "                                    model=2,\n",
    "                                    granularity=\"ride/date/commute\"),\n",
    "    \n",
    "        M3 = fit_ridership_counts_models(data = ride_date_first_counts[year(date) == 2015],\n",
    "                                    random=c(\"new_fraction_10day\",\"new_fraction_10day:IsRouteSeattle\"),\n",
    "                                    model=3,\n",
    "                                    granularity=\"ride/date/commute\"),\n",
    "    \n",
    "        M4 = fit_ridership_counts_models(data = ride_date_last_counts[year(date) == 2015],\n",
    "                                    random=c(\"new_fraction_10day\",\"new_fraction_10day:IsRouteSeattle\"),\n",
    "                                    model=4,\n",
    "                                    granularity=\"ride/date/commute\"),\n",
    "    \n",
    "        M5 = fit_ridership_counts_models(data = ride_date_commute_counts[year(date) == 2015 & IsRouteSeattle == 1],\n",
    "                                    random=c(\"new_fraction_10day\"),\n",
    "                                    model=5,\n",
    "                                    granularity=\"ride/date/commute\"),\n",
    "    \n",
    "        M6 = fit_ridership_counts_models(data = ride_date_commute_counts[year(date) == 2015 & IsRouteSeattle == 0],\n",
    "                                    random=c(\"new_fraction_10day\"),\n",
    "                                    model=6,\n",
    "                                    granularity=\"ride/date/commute\"))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Table 2 Summary Statistics \n",
    "* Pre 520 HOV data only"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<thead><tr><th></th><th scope=col>model</th><th scope=col>OLS Estimate</th><th scope=col>OLS Estimate (%)</th><th scope=col>OLS p-value</th><th scope=col>BS p-value</th><th scope=col>CI lower</th><th scope=col>CI higher</th><th scope=col>CI lower (%)</th><th scope=col>CI higher (%)</th><th scope=col>N</th><th scope=col>r2</th><th scope=col>granularity</th></tr></thead>\n",
       "<tbody>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>1                   </td><td>0.0686514332241706  </td><td>7.10628071649599    </td><td>4.6490140992016e-05 </td><td>0.0929070929070929  </td><td>-0.010369400921334  </td><td>0.147672267369675   </td><td>-1.03158240302671   </td><td>15.9132948415624    </td><td>3146                </td><td>0.912631676017193   </td><td>ride/date/commute   </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>2                   </td><td>0.0948836061695123  </td><td>9.95308690682635    </td><td>5.43384386471706e-06</td><td>0.240759240759241   </td><td>-0.0458378657888544 </td><td>0.235605078127879   </td><td>-4.48031802806223   </td><td>26.5674368963233    </td><td>3146                </td><td>0.912762206937049   </td><td>ride/date/commute   </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:IsRouteSeattle</th><td>2                   </td><td>-0.0495989236659079 </td><td>-4.83889833701558   </td><td>0.0327661350683815  </td><td>0.489510489510489   </td><td>-0.191742044294191  </td><td>0.0925441969623756  </td><td>-17.4480211431754   </td><td>9.69616228605061    </td><td>3146                </td><td>0.912762206937049   </td><td>ride/date/commute   </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>3                   </td><td>-0.0806820648151046 </td><td>-7.75130641197014   </td><td>0.0533934225546946  </td><td>0.117882117882118   </td><td>-0.181981219176523  </td><td>0.0206170895463135  </td><td>-16.6383003717625   </td><td>2.08310898948676    </td><td>1124                </td><td>0.91642258210363    </td><td>ride/date/commute   </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:IsRouteSeattle</th><td>3                   </td><td>-0.00508206594422906</td><td>-0.50691740954194   </td><td>0.902946943863471   </td><td>0.951048951048951   </td><td>-0.231253148684275  </td><td>0.221089016795817   </td><td>-20.6461442635286   </td><td>24.7434468241238    </td><td>1124                </td><td>0.91642258210363    </td><td>ride/date/commute   </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>4                   </td><td>-0.0906907079587416 </td><td>-8.669985631437     </td><td>0.016690341799592   </td><td>0.458541458541459   </td><td>-0.476958240691322  </td><td>0.295576824773839   </td><td>-37.9331552562445   </td><td>34.3901330734414    </td><td>1050                </td><td>0.922313452935771   </td><td>ride/date/commute   </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:IsRouteSeattle</th><td>4                   </td><td>0.0904534283720106  </td><td>9.46705258660021    </td><td>0.0137150359648167  </td><td>0.445554445554446   </td><td>-0.221194371822034  </td><td>0.402101228566055   </td><td>-19.8439135698098   </td><td>49.4962657942863    </td><td>1050                </td><td>0.922313452935771   </td><td>ride/date/commute   </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>5                   </td><td>0.0141517461047198  </td><td>1.4252356105791     </td><td>0.406340197607367   </td><td>0.675324675324675   </td><td>-0.0441147566632029 </td><td>0.0724182488726424  </td><td>-4.31558530690855   </td><td>7.5104911458922     </td><td>1500                </td><td>0.954941303315343   </td><td>ride/date/commute   </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>6                   </td><td>0.153108491224041   </td><td>16.5451413334496    </td><td>3.55153352795565e-07</td><td>0.0659340659340659  </td><td>-0.010482825569908  </td><td>0.31669980801799    </td><td>-1.04280722441482   </td><td>37.2590469420116    </td><td>1646                </td><td>0.812501777561731   </td><td>ride/date/commute   </td></tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/latex": [
       "\\begin{tabular}{r|llllllllllll}\n",
       "  & model & OLS Estimate & OLS Estimate (\\%) & OLS p-value & BS p-value & CI lower & CI higher & CI lower (\\%) & CI higher (\\%) & N & r2 & granularity\\\\\n",
       "\\hline\n",
       "\tnew\\_fraction\\_10day & 1                    & 0.0686514332241706   & 7.10628071649599     & 4.6490140992016e-05  & 0.0929070929070929   & -0.010369400921334   & 0.147672267369675    & -1.03158240302671    & 15.9132948415624     & 3146                 & 0.912631676017193    & ride/date/commute   \\\\\n",
       "\tnew\\_fraction\\_10day & 2                    & 0.0948836061695123   & 9.95308690682635     & 5.43384386471706e-06 & 0.240759240759241    & -0.0458378657888544  & 0.235605078127879    & -4.48031802806223    & 26.5674368963233     & 3146                 & 0.912762206937049    & ride/date/commute   \\\\\n",
       "\tnew\\_fraction\\_10day:IsRouteSeattle & 2                    & -0.0495989236659079  & -4.83889833701558    & 0.0327661350683815   & 0.489510489510489    & -0.191742044294191   & 0.0925441969623756   & -17.4480211431754    & 9.69616228605061     & 3146                 & 0.912762206937049    & ride/date/commute   \\\\\n",
       "\tnew\\_fraction\\_10day & 3                    & -0.0806820648151046  & -7.75130641197014    & 0.0533934225546946   & 0.117882117882118    & -0.181981219176523   & 0.0206170895463135   & -16.6383003717625    & 2.08310898948676     & 1124                 & 0.91642258210363     & ride/date/commute   \\\\\n",
       "\tnew\\_fraction\\_10day:IsRouteSeattle & 3                    & -0.00508206594422906 & -0.50691740954194    & 0.902946943863471    & 0.951048951048951    & -0.231253148684275   & 0.221089016795817    & -20.6461442635286    & 24.7434468241238     & 1124                 & 0.91642258210363     & ride/date/commute   \\\\\n",
       "\tnew\\_fraction\\_10day & 4                    & -0.0906907079587416  & -8.669985631437      & 0.016690341799592    & 0.458541458541459    & -0.476958240691322   & 0.295576824773839    & -37.9331552562445    & 34.3901330734414     & 1050                 & 0.922313452935771    & ride/date/commute   \\\\\n",
       "\tnew\\_fraction\\_10day:IsRouteSeattle & 4                    & 0.0904534283720106   & 9.46705258660021     & 0.0137150359648167   & 0.445554445554446    & -0.221194371822034   & 0.402101228566055    & -19.8439135698098    & 49.4962657942863     & 1050                 & 0.922313452935771    & ride/date/commute   \\\\\n",
       "\tnew\\_fraction\\_10day & 5                    & 0.0141517461047198   & 1.4252356105791      & 0.406340197607367    & 0.675324675324675    & -0.0441147566632029  & 0.0724182488726424   & -4.31558530690855    & 7.5104911458922      & 1500                 & 0.954941303315343    & ride/date/commute   \\\\\n",
       "\tnew\\_fraction\\_10day & 6                    & 0.153108491224041    & 16.5451413334496     & 3.55153352795565e-07 & 0.0659340659340659   & -0.010482825569908   & 0.31669980801799     & -1.04280722441482    & 37.2590469420116     & 1646                 & 0.812501777561731    & ride/date/commute   \\\\\n",
       "\\end{tabular}\n"
      ],
      "text/markdown": [
       "\n",
       "| <!--/--> | model | OLS Estimate | OLS Estimate (%) | OLS p-value | BS p-value | CI lower | CI higher | CI lower (%) | CI higher (%) | N | r2 | granularity |\n",
       "|---|---|---|---|---|---|---|---|---|---|---|---|---|\n",
       "| new_fraction_10day | 1                    | 0.0686514332241706   | 7.10628071649599     | 4.6490140992016e-05  | 0.0929070929070929   | -0.010369400921334   | 0.147672267369675    | -1.03158240302671    | 15.9132948415624     | 3146                 | 0.912631676017193    | ride/date/commute    |\n",
       "| new_fraction_10day | 2                    | 0.0948836061695123   | 9.95308690682635     | 5.43384386471706e-06 | 0.240759240759241    | -0.0458378657888544  | 0.235605078127879    | -4.48031802806223    | 26.5674368963233     | 3146                 | 0.912762206937049    | ride/date/commute    |\n",
       "| new_fraction_10day:IsRouteSeattle | 2                    | -0.0495989236659079  | -4.83889833701558    | 0.0327661350683815   | 0.489510489510489    | -0.191742044294191   | 0.0925441969623756   | -17.4480211431754    | 9.69616228605061     | 3146                 | 0.912762206937049    | ride/date/commute    |\n",
       "| new_fraction_10day | 3                    | -0.0806820648151046  | -7.75130641197014    | 0.0533934225546946   | 0.117882117882118    | -0.181981219176523   | 0.0206170895463135   | -16.6383003717625    | 2.08310898948676     | 1124                 | 0.91642258210363     | ride/date/commute    |\n",
       "| new_fraction_10day:IsRouteSeattle | 3                    | -0.00508206594422906 | -0.50691740954194    | 0.902946943863471    | 0.951048951048951    | -0.231253148684275   | 0.221089016795817    | -20.6461442635286    | 24.7434468241238     | 1124                 | 0.91642258210363     | ride/date/commute    |\n",
       "| new_fraction_10day | 4                    | -0.0906907079587416  | -8.669985631437      | 0.016690341799592    | 0.458541458541459    | -0.476958240691322   | 0.295576824773839    | -37.9331552562445    | 34.3901330734414     | 1050                 | 0.922313452935771    | ride/date/commute    |\n",
       "| new_fraction_10day:IsRouteSeattle | 4                    | 0.0904534283720106   | 9.46705258660021     | 0.0137150359648167   | 0.445554445554446    | -0.221194371822034   | 0.402101228566055    | -19.8439135698098    | 49.4962657942863     | 1050                 | 0.922313452935771    | ride/date/commute    |\n",
       "| new_fraction_10day | 5                    | 0.0141517461047198   | 1.4252356105791      | 0.406340197607367    | 0.675324675324675    | -0.0441147566632029  | 0.0724182488726424   | -4.31558530690855    | 7.5104911458922      | 1500                 | 0.954941303315343    | ride/date/commute    |\n",
       "| new_fraction_10day | 6                    | 0.153108491224041    | 16.5451413334496     | 3.55153352795565e-07 | 0.0659340659340659   | -0.010482825569908   | 0.31669980801799     | -1.04280722441482    | 37.2590469420116     | 1646                 | 0.812501777561731    | ride/date/commute    |\n",
       "\n"
      ],
      "text/plain": [
       "                                  model OLS Estimate         OLS Estimate (%) \n",
       "new_fraction_10day                1     0.0686514332241706   7.10628071649599 \n",
       "new_fraction_10day                2     0.0948836061695123   9.95308690682635 \n",
       "new_fraction_10day:IsRouteSeattle 2     -0.0495989236659079  -4.83889833701558\n",
       "new_fraction_10day                3     -0.0806820648151046  -7.75130641197014\n",
       "new_fraction_10day:IsRouteSeattle 3     -0.00508206594422906 -0.50691740954194\n",
       "new_fraction_10day                4     -0.0906907079587416  -8.669985631437  \n",
       "new_fraction_10day:IsRouteSeattle 4     0.0904534283720106   9.46705258660021 \n",
       "new_fraction_10day                5     0.0141517461047198   1.4252356105791  \n",
       "new_fraction_10day                6     0.153108491224041    16.5451413334496 \n",
       "                                  OLS p-value          BS p-value        \n",
       "new_fraction_10day                4.6490140992016e-05  0.0929070929070929\n",
       "new_fraction_10day                5.43384386471706e-06 0.240759240759241 \n",
       "new_fraction_10day:IsRouteSeattle 0.0327661350683815   0.489510489510489 \n",
       "new_fraction_10day                0.0533934225546946   0.117882117882118 \n",
       "new_fraction_10day:IsRouteSeattle 0.902946943863471    0.951048951048951 \n",
       "new_fraction_10day                0.016690341799592    0.458541458541459 \n",
       "new_fraction_10day:IsRouteSeattle 0.0137150359648167   0.445554445554446 \n",
       "new_fraction_10day                0.406340197607367    0.675324675324675 \n",
       "new_fraction_10day                3.55153352795565e-07 0.0659340659340659\n",
       "                                  CI lower            CI higher         \n",
       "new_fraction_10day                -0.010369400921334  0.147672267369675 \n",
       "new_fraction_10day                -0.0458378657888544 0.235605078127879 \n",
       "new_fraction_10day:IsRouteSeattle -0.191742044294191  0.0925441969623756\n",
       "new_fraction_10day                -0.181981219176523  0.0206170895463135\n",
       "new_fraction_10day:IsRouteSeattle -0.231253148684275  0.221089016795817 \n",
       "new_fraction_10day                -0.476958240691322  0.295576824773839 \n",
       "new_fraction_10day:IsRouteSeattle -0.221194371822034  0.402101228566055 \n",
       "new_fraction_10day                -0.0441147566632029 0.0724182488726424\n",
       "new_fraction_10day                -0.010482825569908  0.31669980801799  \n",
       "                                  CI lower (%)      CI higher (%)    N   \n",
       "new_fraction_10day                -1.03158240302671 15.9132948415624 3146\n",
       "new_fraction_10day                -4.48031802806223 26.5674368963233 3146\n",
       "new_fraction_10day:IsRouteSeattle -17.4480211431754 9.69616228605061 3146\n",
       "new_fraction_10day                -16.6383003717625 2.08310898948676 1124\n",
       "new_fraction_10day:IsRouteSeattle -20.6461442635286 24.7434468241238 1124\n",
       "new_fraction_10day                -37.9331552562445 34.3901330734414 1050\n",
       "new_fraction_10day:IsRouteSeattle -19.8439135698098 49.4962657942863 1050\n",
       "new_fraction_10day                -4.31558530690855 7.5104911458922  1500\n",
       "new_fraction_10day                -1.04280722441482 37.2590469420116 1646\n",
       "                                  r2                granularity      \n",
       "new_fraction_10day                0.912631676017193 ride/date/commute\n",
       "new_fraction_10day                0.912762206937049 ride/date/commute\n",
       "new_fraction_10day:IsRouteSeattle 0.912762206937049 ride/date/commute\n",
       "new_fraction_10day                0.91642258210363  ride/date/commute\n",
       "new_fraction_10day:IsRouteSeattle 0.91642258210363  ride/date/commute\n",
       "new_fraction_10day                0.922313452935771 ride/date/commute\n",
       "new_fraction_10day:IsRouteSeattle 0.922313452935771 ride/date/commute\n",
       "new_fraction_10day                0.954941303315343 ride/date/commute\n",
       "new_fraction_10day                0.812501777561731 ride/date/commute"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "(TABLE_2_2015 <- do.call(rbind,lapply(TABLE_2_MODELS_2015,function(x)x$coef)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Fit the Models for table 2\n",
    "* Pre 520 HOV data only"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "===============================================\n",
      "Model  1 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + fDate + fRoute\n",
      "<environment: 0x000000006aa99750>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                    Estimate Std. Error    t value    Pr(>|t|)\n",
      "(Intercept)        4.6294488 0.03189352 145.153265 0.000000000\n",
      "new_fraction_10day 0.0360534 0.01164701   3.095507 0.001974079\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  2 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + new_fraction_10day:IsRouteSeattle + \n",
      "    fDate + fRoute\n",
      "<environment: 0x000000002d8ca010>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                                      Estimate Std. Error      t value\n",
      "(Intercept)                        4.629864796 0.03233067 143.20347177\n",
      "new_fraction_10day                 0.036638599 0.01381634   2.65183049\n",
      "new_fraction_10day:IsRouteSeattle -0.001215721 0.01543690  -0.07875423\n",
      "                                     Pr(>|t|)\n",
      "(Intercept)                       0.000000000\n",
      "new_fraction_10day                0.008027322\n",
      "new_fraction_10day:IsRouteSeattle 0.937230811\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  3 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + new_fraction_10day:IsRouteSeattle + \n",
      "    fDate + fRoute\n",
      "<environment: 0x0000000029a67e08>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                                     Estimate Std. Error    t value  Pr(>|t|)\n",
      "(Intercept)                        3.79701332 0.06643252 57.1559456 0.0000000\n",
      "new_fraction_10day                -0.02295910 0.03384103 -0.6784397 0.4975696\n",
      "new_fraction_10day:IsRouteSeattle  0.03449477 0.03364584  1.0252311 0.3053752\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  4 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + new_fraction_10day:IsRouteSeattle + \n",
      "    fDate + fRoute\n",
      "<environment: 0x000000002d85fd60>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                                    Estimate Std. Error   t value     Pr(>|t|)\n",
      "(Intercept)                        3.5707728 0.05710396 62.531085 0.000000e+00\n",
      "new_fraction_10day                -0.1604714 0.02961522 -5.418547 6.758163e-08\n",
      "new_fraction_10day:IsRouteSeattle  0.1140160 0.02830396  4.028270 5.835806e-05\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  5 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + fDate + fRoute\n",
      "<environment: 0x00000000733360b0>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                      Estimate Std. Error     t value Pr(>|t|)\n",
      "(Intercept)        4.655995298 0.03332237 139.7258252 0.000000\n",
      "new_fraction_10day 0.008475886 0.01237569   0.6848821 0.493477\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  6 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + fDate + fRoute\n",
      "<environment: 0x000000003b095240>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                    Estimate Std. Error   t value     Pr(>|t|)\n",
      "(Intercept)        3.6661966 0.05016701 73.079824 0.0000000000\n",
      "new_fraction_10day 0.0762047 0.01965387  3.877338 0.0001078794\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n"
     ]
    }
   ],
   "source": [
    "TABLE_2_MODELS_pre_hov <- list(\n",
    "    \n",
    "        M1 = fit_ridership_counts_models(data = ride_date_commute_counts[(!SR520WBHOV) & (!SR520EBHOV)],\n",
    "                                    random=c(\"new_fraction_10day\"),\n",
    "                                    model=1,\n",
    "                                    granularity=\"ride/date/commute\"),\n",
    "    \n",
    "        M2 = fit_ridership_counts_models(data = ride_date_commute_counts[(!SR520WBHOV) & (!SR520EBHOV)],\n",
    "                                    random=c(\"new_fraction_10day\",\"new_fraction_10day:IsRouteSeattle\"),\n",
    "                                    model=2,\n",
    "                                    granularity=\"ride/date/commute\"),\n",
    "    \n",
    "        M3 = fit_ridership_counts_models(data = ride_date_first_counts[(!SR520WBHOV) & (!SR520EBHOV)],\n",
    "                                    random=c(\"new_fraction_10day\",\"new_fraction_10day:IsRouteSeattle\"),\n",
    "                                    model=3,\n",
    "                                    granularity=\"ride/date/commute\"),\n",
    "    \n",
    "        M4 = fit_ridership_counts_models(data = ride_date_last_counts[(!SR520WBHOV) & (!SR520EBHOV)],\n",
    "                                    random=c(\"new_fraction_10day\",\"new_fraction_10day:IsRouteSeattle\"),\n",
    "                                    model=4,\n",
    "                                    granularity=\"ride/date/commute\"),\n",
    "    \n",
    "        M5 = fit_ridership_counts_models(data = ride_date_commute_counts[(!SR520WBHOV) & (!SR520EBHOV) & IsRouteSeattle == 1],\n",
    "                                    random=c(\"new_fraction_10day\"),\n",
    "                                    model=5,\n",
    "                                    granularity=\"ride/date/commute [seattle routes only]\"),\n",
    "    \n",
    "        M6 = fit_ridership_counts_models(data = ride_date_commute_counts[(!SR520WBHOV) & (!SR520EBHOV) & IsRouteSeattle == 0],\n",
    "                                    random=c(\"new_fraction_10day\"),\n",
    "                                    model=6,\n",
    "                                    granularity=\"ride/date/commute [Non-seatle routes only]\"))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Table 2 Summary Statistics \n",
    "* Pre 520 HOV data only"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<thead><tr><th></th><th scope=col>model</th><th scope=col>OLS Estimate</th><th scope=col>OLS Estimate (%)</th><th scope=col>OLS p-value</th><th scope=col>BS p-value</th><th scope=col>CI lower</th><th scope=col>CI higher</th><th scope=col>CI lower (%)</th><th scope=col>CI higher (%)</th><th scope=col>N</th><th scope=col>r2</th><th scope=col>granularity</th></tr></thead>\n",
       "<tbody>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>1                                         </td><td>0.0360533997183386                        </td><td>3.67112050991942                          </td><td>0.00197407872484313                       </td><td>0.320679320679321                         </td><td>-0.0336895678903819                       </td><td>0.105796367327059                         </td><td>-3.31283939530652                         </td><td>11.159549629597                           </td><td>6000                                      </td><td>0.926075515608972                         </td><td>ride/date/commute                         </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>2                                         </td><td>0.0366385990766596                        </td><td>3.73180653809877                          </td><td>0.00802732191061367                       </td><td>0.55044955044955                          </td><td>-0.0997830624723441                       </td><td>0.173060260625663                         </td><td>-9.49662674784215                         </td><td>18.8937749057988                          </td><td>6000                                      </td><td>0.926075594185847                         </td><td>ride/date/commute                         </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:IsRouteSeattle</th><td>2                                         </td><td>-0.00121572117255949                      </td><td>-0.121498248295193                        </td><td>0.937230811058164                         </td><td>0.987012987012987                         </td><td>-0.155146502527441                        </td><td>0.152715060182322                         </td><td>-14.371028031426                          </td><td>16.4992978757985                          </td><td>6000                                      </td><td>0.926075594185847                         </td><td>ride/date/commute                         </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>3                                         </td><td>-0.0229591005694315                       </td><td>-2.2697545930245                          </td><td>0.497569568316396                         </td><td>0.8001998001998                           </td><td>-0.198438453322277                        </td><td>0.152520252183414                         </td><td>-17.9989761906807                         </td><td>16.4766050911448                          </td><td>2209                                      </td><td>0.899534086047275                         </td><td>ride/date/commute                         </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:IsRouteSeattle</th><td>3                                         </td><td>0.0344947656489465                        </td><td>3.50966103029018                          </td><td>0.305375183274141                         </td><td>0.739260739260739                         </td><td>-0.179836739399465                        </td><td>0.248826270697358                         </td><td>-16.4593410740142                         </td><td>28.2519202547593                          </td><td>2209                                      </td><td>0.899534086047275                         </td><td>ride/date/commute                         </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>4                                         </td><td>-0.16047143350645                         </td><td>-14.8257845488812                         </td><td>6.75816259145674e-08                      </td><td>0.054945054945055                         </td><td>-0.323553221427134                        </td><td>0.00261035441423454                       </td><td>-27.6426552713905                         </td><td>0.261376435572491                         </td><td>2097                                      </td><td>0.929093503512083                         </td><td>ride/date/commute                         </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:IsRouteSeattle</th><td>4                                         </td><td>0.114016002487684                         </td><td>12.077005984973                           </td><td>5.83580579889835e-05                      </td><td>0.18981018981019                          </td><td>-0.0603507283115944                       </td><td>0.288382733286962                         </td><td>-5.85657119839142                         </td><td>33.426787514043                           </td><td>2097                                      </td><td>0.929093503512083                         </td><td>ride/date/commute                         </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>5                                         </td><td>0.00847588643484512                       </td><td>0.851190846121641                         </td><td>0.493476979911932                         </td><td>0.795204795204795                         </td><td>-0.0698504601480793                       </td><td>0.0868022330177695                        </td><td>-6.74667396345983                         </td><td>9.06809577060534                          </td><td>2858                                      </td><td>0.96124568085491                          </td><td>ride/date/commute [seattle routes only]   </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>6                                         </td><td>0.0762047015137445                        </td><td>7.9183462036758                           </td><td>0.00010787936512618                       </td><td>0.236763236763237                         </td><td>-0.0569495485922389                       </td><td>0.209358951619728                         </td><td>-5.53582733307354                         </td><td>23.2887466066171                          </td><td>3142                                      </td><td>0.833293973022539                         </td><td>ride/date/commute [Non-seatle routes only]</td></tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/latex": [
       "\\begin{tabular}{r|llllllllllll}\n",
       "  & model & OLS Estimate & OLS Estimate (\\%) & OLS p-value & BS p-value & CI lower & CI higher & CI lower (\\%) & CI higher (\\%) & N & r2 & granularity\\\\\n",
       "\\hline\n",
       "\tnew\\_fraction\\_10day & 1                                          & 0.0360533997183386                         & 3.67112050991942                           & 0.00197407872484313                        & 0.320679320679321                          & -0.0336895678903819                        & 0.105796367327059                          & -3.31283939530652                          & 11.159549629597                            & 6000                                       & 0.926075515608972                          & ride/date/commute                         \\\\\n",
       "\tnew\\_fraction\\_10day & 2                                          & 0.0366385990766596                         & 3.73180653809877                           & 0.00802732191061367                        & 0.55044955044955                           & -0.0997830624723441                        & 0.173060260625663                          & -9.49662674784215                          & 18.8937749057988                           & 6000                                       & 0.926075594185847                          & ride/date/commute                         \\\\\n",
       "\tnew\\_fraction\\_10day:IsRouteSeattle & 2                                          & -0.00121572117255949                       & -0.121498248295193                         & 0.937230811058164                          & 0.987012987012987                          & -0.155146502527441                         & 0.152715060182322                          & -14.371028031426                           & 16.4992978757985                           & 6000                                       & 0.926075594185847                          & ride/date/commute                         \\\\\n",
       "\tnew\\_fraction\\_10day & 3                                          & -0.0229591005694315                        & -2.2697545930245                           & 0.497569568316396                          & 0.8001998001998                            & -0.198438453322277                         & 0.152520252183414                          & -17.9989761906807                          & 16.4766050911448                           & 2209                                       & 0.899534086047275                          & ride/date/commute                         \\\\\n",
       "\tnew\\_fraction\\_10day:IsRouteSeattle & 3                                          & 0.0344947656489465                         & 3.50966103029018                           & 0.305375183274141                          & 0.739260739260739                          & -0.179836739399465                         & 0.248826270697358                          & -16.4593410740142                          & 28.2519202547593                           & 2209                                       & 0.899534086047275                          & ride/date/commute                         \\\\\n",
       "\tnew\\_fraction\\_10day & 4                                          & -0.16047143350645                          & -14.8257845488812                          & 6.75816259145674e-08                       & 0.054945054945055                          & -0.323553221427134                         & 0.00261035441423454                        & -27.6426552713905                          & 0.261376435572491                          & 2097                                       & 0.929093503512083                          & ride/date/commute                         \\\\\n",
       "\tnew\\_fraction\\_10day:IsRouteSeattle & 4                                          & 0.114016002487684                          & 12.077005984973                            & 5.83580579889835e-05                       & 0.18981018981019                           & -0.0603507283115944                        & 0.288382733286962                          & -5.85657119839142                          & 33.426787514043                            & 2097                                       & 0.929093503512083                          & ride/date/commute                         \\\\\n",
       "\tnew\\_fraction\\_10day & 5                                              & 0.00847588643484512                            & 0.851190846121641                              & 0.493476979911932                              & 0.795204795204795                              & -0.0698504601480793                            & 0.0868022330177695                             & -6.74667396345983                              & 9.06809577060534                               & 2858                                           & 0.96124568085491                               & ride/date/commute {[}seattle routes only{]}   \\\\\n",
       "\tnew\\_fraction\\_10day & 6                                              & 0.0762047015137445                             & 7.9183462036758                                & 0.00010787936512618                            & 0.236763236763237                              & -0.0569495485922389                            & 0.209358951619728                              & -5.53582733307354                              & 23.2887466066171                               & 3142                                           & 0.833293973022539                              & ride/date/commute {[}Non-seatle routes only{]}\\\\\n",
       "\\end{tabular}\n"
      ],
      "text/markdown": [
       "\n",
       "| <!--/--> | model | OLS Estimate | OLS Estimate (%) | OLS p-value | BS p-value | CI lower | CI higher | CI lower (%) | CI higher (%) | N | r2 | granularity |\n",
       "|---|---|---|---|---|---|---|---|---|---|---|---|---|\n",
       "| new_fraction_10day | 1                                          | 0.0360533997183386                         | 3.67112050991942                           | 0.00197407872484313                        | 0.320679320679321                          | -0.0336895678903819                        | 0.105796367327059                          | -3.31283939530652                          | 11.159549629597                            | 6000                                       | 0.926075515608972                          | ride/date/commute                          |\n",
       "| new_fraction_10day | 2                                          | 0.0366385990766596                         | 3.73180653809877                           | 0.00802732191061367                        | 0.55044955044955                           | -0.0997830624723441                        | 0.173060260625663                          | -9.49662674784215                          | 18.8937749057988                           | 6000                                       | 0.926075594185847                          | ride/date/commute                          |\n",
       "| new_fraction_10day:IsRouteSeattle | 2                                          | -0.00121572117255949                       | -0.121498248295193                         | 0.937230811058164                          | 0.987012987012987                          | -0.155146502527441                         | 0.152715060182322                          | -14.371028031426                           | 16.4992978757985                           | 6000                                       | 0.926075594185847                          | ride/date/commute                          |\n",
       "| new_fraction_10day | 3                                          | -0.0229591005694315                        | -2.2697545930245                           | 0.497569568316396                          | 0.8001998001998                            | -0.198438453322277                         | 0.152520252183414                          | -17.9989761906807                          | 16.4766050911448                           | 2209                                       | 0.899534086047275                          | ride/date/commute                          |\n",
       "| new_fraction_10day:IsRouteSeattle | 3                                          | 0.0344947656489465                         | 3.50966103029018                           | 0.305375183274141                          | 0.739260739260739                          | -0.179836739399465                         | 0.248826270697358                          | -16.4593410740142                          | 28.2519202547593                           | 2209                                       | 0.899534086047275                          | ride/date/commute                          |\n",
       "| new_fraction_10day | 4                                          | -0.16047143350645                          | -14.8257845488812                          | 6.75816259145674e-08                       | 0.054945054945055                          | -0.323553221427134                         | 0.00261035441423454                        | -27.6426552713905                          | 0.261376435572491                          | 2097                                       | 0.929093503512083                          | ride/date/commute                          |\n",
       "| new_fraction_10day:IsRouteSeattle | 4                                          | 0.114016002487684                          | 12.077005984973                            | 5.83580579889835e-05                       | 0.18981018981019                           | -0.0603507283115944                        | 0.288382733286962                          | -5.85657119839142                          | 33.426787514043                            | 2097                                       | 0.929093503512083                          | ride/date/commute                          |\n",
       "| new_fraction_10day | 5                                          | 0.00847588643484512                        | 0.851190846121641                          | 0.493476979911932                          | 0.795204795204795                          | -0.0698504601480793                        | 0.0868022330177695                         | -6.74667396345983                          | 9.06809577060534                           | 2858                                       | 0.96124568085491                           | ride/date/commute [seattle routes only]    |\n",
       "| new_fraction_10day | 6                                          | 0.0762047015137445                         | 7.9183462036758                            | 0.00010787936512618                        | 0.236763236763237                          | -0.0569495485922389                        | 0.209358951619728                          | -5.53582733307354                          | 23.2887466066171                           | 3142                                       | 0.833293973022539                          | ride/date/commute [Non-seatle routes only] |\n",
       "\n"
      ],
      "text/plain": [
       "                                  model OLS Estimate         OLS Estimate (%)  \n",
       "new_fraction_10day                1     0.0360533997183386   3.67112050991942  \n",
       "new_fraction_10day                2     0.0366385990766596   3.73180653809877  \n",
       "new_fraction_10day:IsRouteSeattle 2     -0.00121572117255949 -0.121498248295193\n",
       "new_fraction_10day                3     -0.0229591005694315  -2.2697545930245  \n",
       "new_fraction_10day:IsRouteSeattle 3     0.0344947656489465   3.50966103029018  \n",
       "new_fraction_10day                4     -0.16047143350645    -14.8257845488812 \n",
       "new_fraction_10day:IsRouteSeattle 4     0.114016002487684    12.077005984973   \n",
       "new_fraction_10day                5     0.00847588643484512  0.851190846121641 \n",
       "new_fraction_10day                6     0.0762047015137445   7.9183462036758   \n",
       "                                  OLS p-value          BS p-value       \n",
       "new_fraction_10day                0.00197407872484313  0.320679320679321\n",
       "new_fraction_10day                0.00802732191061367  0.55044955044955 \n",
       "new_fraction_10day:IsRouteSeattle 0.937230811058164    0.987012987012987\n",
       "new_fraction_10day                0.497569568316396    0.8001998001998  \n",
       "new_fraction_10day:IsRouteSeattle 0.305375183274141    0.739260739260739\n",
       "new_fraction_10day                6.75816259145674e-08 0.054945054945055\n",
       "new_fraction_10day:IsRouteSeattle 5.83580579889835e-05 0.18981018981019 \n",
       "new_fraction_10day                0.493476979911932    0.795204795204795\n",
       "new_fraction_10day                0.00010787936512618  0.236763236763237\n",
       "                                  CI lower            CI higher          \n",
       "new_fraction_10day                -0.0336895678903819 0.105796367327059  \n",
       "new_fraction_10day                -0.0997830624723441 0.173060260625663  \n",
       "new_fraction_10day:IsRouteSeattle -0.155146502527441  0.152715060182322  \n",
       "new_fraction_10day                -0.198438453322277  0.152520252183414  \n",
       "new_fraction_10day:IsRouteSeattle -0.179836739399465  0.248826270697358  \n",
       "new_fraction_10day                -0.323553221427134  0.00261035441423454\n",
       "new_fraction_10day:IsRouteSeattle -0.0603507283115944 0.288382733286962  \n",
       "new_fraction_10day                -0.0698504601480793 0.0868022330177695 \n",
       "new_fraction_10day                -0.0569495485922389 0.209358951619728  \n",
       "                                  CI lower (%)      CI higher (%)     N   \n",
       "new_fraction_10day                -3.31283939530652 11.159549629597   6000\n",
       "new_fraction_10day                -9.49662674784215 18.8937749057988  6000\n",
       "new_fraction_10day:IsRouteSeattle -14.371028031426  16.4992978757985  6000\n",
       "new_fraction_10day                -17.9989761906807 16.4766050911448  2209\n",
       "new_fraction_10day:IsRouteSeattle -16.4593410740142 28.2519202547593  2209\n",
       "new_fraction_10day                -27.6426552713905 0.261376435572491 2097\n",
       "new_fraction_10day:IsRouteSeattle -5.85657119839142 33.426787514043   2097\n",
       "new_fraction_10day                -6.74667396345983 9.06809577060534  2858\n",
       "new_fraction_10day                -5.53582733307354 23.2887466066171  3142\n",
       "                                  r2               \n",
       "new_fraction_10day                0.926075515608972\n",
       "new_fraction_10day                0.926075594185847\n",
       "new_fraction_10day:IsRouteSeattle 0.926075594185847\n",
       "new_fraction_10day                0.899534086047275\n",
       "new_fraction_10day:IsRouteSeattle 0.899534086047275\n",
       "new_fraction_10day                0.929093503512083\n",
       "new_fraction_10day:IsRouteSeattle 0.929093503512083\n",
       "new_fraction_10day                0.96124568085491 \n",
       "new_fraction_10day                0.833293973022539\n",
       "                                  granularity                               \n",
       "new_fraction_10day                ride/date/commute                         \n",
       "new_fraction_10day                ride/date/commute                         \n",
       "new_fraction_10day:IsRouteSeattle ride/date/commute                         \n",
       "new_fraction_10day                ride/date/commute                         \n",
       "new_fraction_10day:IsRouteSeattle ride/date/commute                         \n",
       "new_fraction_10day                ride/date/commute                         \n",
       "new_fraction_10day:IsRouteSeattle ride/date/commute                         \n",
       "new_fraction_10day                ride/date/commute [seattle routes only]   \n",
       "new_fraction_10day                ride/date/commute [Non-seatle routes only]"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "(TABLE_2_pre_hov <- do.call(rbind,lapply(TABLE_2_MODELS_pre_hov,function(x)x$coef)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Fit the Models for Table 3 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "===============================================\n",
      "Model  1 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + AfternoonId + fDate + fRoute + \n",
      "    post_hov:IsRouteSeattle\n",
      "<environment: 0x000000002b64af80>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                         Estimate  Std. Error   t value     Pr(>|t|)\n",
      "(Intercept)             4.6730280 0.030089133 155.30617 0.000000e+00\n",
      "post_hov:IsRouteSeattle 0.1149255 0.007730744  14.86604 1.979189e-49\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  1 :\n",
      "===============================================\n",
      "log(Ridership) ~ is_peak + new_fraction_10day + AfternoonId + \n",
      "    fDate + fRoute + post_hov:IsRouteSeattle + IsRouteSeattle:is_peak + \n",
      "    post_hov:is_peak + post_hov:IsRouteSeattle:is_peak\n",
      "<environment: 0x000000002a207900>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                                   Estimate Std. Error    t value     Pr(>|t|)\n",
      "(Intercept)                      3.51674392 0.05594065  62.865624 0.000000e+00\n",
      "post_hov:IsRouteSeattle          0.03945748 0.02044887   1.929568 5.367659e-02\n",
      "is_peak                          0.90338983 0.01240124  72.846728 0.000000e+00\n",
      "is_peak:IsRouteSeattle          -0.18962778 0.01773659 -10.691331 1.350571e-26\n",
      "is_peak:post_hov                -0.14070848 0.01960988  -7.175386 7.499462e-13\n",
      "is_peak:post_hov:IsRouteSeattle  0.10442700 0.02858057   3.653776 2.591682e-04\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  3 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + fDate + fRoute + post_hov:IsRouteSeattle\n",
      "<environment: 0x000000002b249d08>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                         Estimate Std. Error   t value     Pr(>|t|)\n",
      "(Intercept)             3.8453073 0.07154058 53.750017 0.000000e+00\n",
      "post_hov:IsRouteSeattle 0.1356714 0.01886124  7.193131 7.768651e-13\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  4 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + fDate + fRoute + post_hov:IsRouteSeattle\n",
      "<environment: 0x000000002a5d1548>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                         Estimate Std. Error   t value     Pr(>|t|)\n",
      "(Intercept)             3.6124908 0.05937088 60.846167 0.000000e+00\n",
      "post_hov:IsRouteSeattle 0.1111683 0.01536038  7.237341 5.680401e-13\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  5 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + fDate + fRoute\n",
      "<environment: 0x0000000028db03d8>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                      Estimate Std. Error    t value Pr(>|t|)\n",
      "(Intercept)         4.81773775 0.03378260 142.610048 0.000000\n",
      "new_fraction_10day -0.02276022 0.02237232  -1.017338 0.309062\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n"
     ]
    }
   ],
   "source": [
    "ride_date_commute_counts[,post_hov :=  0 + ((AfternoonId ==0 & SR520WBHOV) | (AfternoonId ==1 & SR520EBHOV))]\n",
    "ride_date_first_counts[,post_hov :=  0 + SR520WBHOV]\n",
    "ride_date_last_counts[,post_hov :=  0 + SR520WBHOV]\n",
    "ride_date_commute_counts_peak[,post_hov :=  0 + ((AfternoonId ==0 & SR520WBHOV) | (AfternoonId ==1 & SR520EBHOV))]\n",
    "\n",
    "ride_date_commute_counts_peak[,is_peak := 0 + is_peak]\n",
    "\n",
    "TABLE_3_MODELS <- list(\n",
    "    \n",
    "        M1 = fit_ridership_counts_models(data = ride_date_commute_counts,\n",
    "                                    random=c(\"post_hov:IsRouteSeattle\"),\n",
    "                                    fixed=\"new_fraction_10day + AfternoonId + fDate + fRoute\",\n",
    "                                    model=1,\n",
    "                                    granularity=\"ride/date/commute\"),\n",
    "    \n",
    "        M2 = fit_ridership_counts_models(data = ride_date_commute_counts_peak,\n",
    "                                    random=c(\"post_hov:IsRouteSeattle\",\n",
    "                                             \"is_peak\",\n",
    "                                             \"is_peak:IsRouteSeattle\",\n",
    "                                             \"is_peak:post_hov\",\n",
    "                                             \"is_peak:post_hov:IsRouteSeattle\"\n",
    "                                            ),\n",
    "                                    fixed=\"new_fraction_10day + AfternoonId + fDate + fRoute\",\n",
    "                                    granularity=\"ride/date/commute/peak\"),\n",
    "    \n",
    "        M3 = fit_ridership_counts_models(data = ride_date_first_counts,\n",
    "                                    random=c(\"post_hov:IsRouteSeattle\"),\n",
    "                                    fixed=\"new_fraction_10day +  fDate + fRoute\",\n",
    "                                    model=3,\n",
    "                                    granularity=\"ride/date [first stop, am only]\"),\n",
    "    \n",
    "        M4 = fit_ridership_counts_models(data = ride_date_last_counts,\n",
    "                                    random=c(\"post_hov:IsRouteSeattle\"),\n",
    "                                    fixed=\"new_fraction_10day +  fDate + fRoute\",\n",
    "                                    model=4,\n",
    "                                    granularity=\"ride/date [last stop, am only]\"),\n",
    "    \n",
    "        M5 = fit_ridership_counts_models(data = ride_date_commute_counts[date >= as.Date(\"2016-03-01\") & date < as.Date(\"2016-07-01\")],\n",
    "                                    random=c(\"new_fraction_10day\"),\n",
    "                                    model=5,\n",
    "                                    granularity=\"ride/date/commute\")\n",
    "                                    )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Table 3 Summary Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<thead><tr><th></th><th scope=col>model</th><th scope=col>OLS Estimate</th><th scope=col>OLS Estimate (%)</th><th scope=col>OLS p-value</th><th scope=col>BS p-value</th><th scope=col>CI lower</th><th scope=col>CI higher</th><th scope=col>CI lower (%)</th><th scope=col>CI higher (%)</th><th scope=col>N</th><th scope=col>r2</th><th scope=col>granularity</th></tr></thead>\n",
       "<tbody>\n",
       "\t<tr><th scope=row>post_hov:IsRouteSeattle</th><td>1                              </td><td>0.114925524956228              </td><td>12.1789889109745               </td><td>1.97918934576061e-49           </td><td>0.00299700299700301            </td><td>0.0431243886046994             </td><td>0.186726661307757              </td><td>4.40677569052583               </td><td>20.5297785499036               </td><td>9696                           </td><td>0.932509782055181              </td><td>ride/date/commute              </td></tr>\n",
       "\t<tr><th scope=row>post_hov:IsRouteSeattle</th><td>1                              </td><td>0.0394574818043095             </td><td>4.02462685502551               </td><td>0.0536765880268809             </td><td>0.500499500499501              </td><td>-0.0679741381336909            </td><td>0.14688910174231               </td><td>-6.57153643908847              </td><td>15.8225510716267               </td><td>17730                          </td><td>0.75692601477986               </td><td>ride/date/commute/peak         </td></tr>\n",
       "\t<tr><th scope=row>is_peak</th><td>1                              </td><td>0.903389832415144              </td><td>146.795490109816               </td><td>0                              </td><td>0                              </td><td>0.534328472563959              </td><td>1.27245119226633               </td><td>70.6302028813877               </td><td>256.959160277646               </td><td>17730                          </td><td>0.75692601477986               </td><td>ride/date/commute/peak         </td></tr>\n",
       "\t<tr><th scope=row>is_peak:IsRouteSeattle</th><td>1                              </td><td>-0.189627783146603             </td><td>-17.2733000637119              </td><td>1.35057082748356e-26           </td><td>0.464535464535465              </td><td>-0.67224417049056              </td><td>0.292988604197353              </td><td>-48.9438495907608              </td><td>34.042751509722                </td><td>17730                          </td><td>0.75692601477986               </td><td>ride/date/commute/peak         </td></tr>\n",
       "\t<tr><th scope=row>is_peak:post_hov</th><td>1                              </td><td>-0.140708481795392             </td><td>-13.1257470950524              </td><td>7.49946199896575e-13           </td><td>0.016983016983017              </td><td>-0.249282871639297             </td><td>-0.0321340919514867            </td><td>-22.0640516493698              </td><td>-3.16232781516207              </td><td>17730                          </td><td>0.75692601477986               </td><td>ride/date/commute/peak         </td></tr>\n",
       "\t<tr><th scope=row>is_peak:post_hov:IsRouteSeattle</th><td>1                              </td><td>0.104427004683512              </td><td>11.0074360679448               </td><td>0.000259168238106355           </td><td>0.118881118881119              </td><td>-0.0262682375658352            </td><td>0.235122246932859              </td><td>-2.59262286147461              </td><td>26.5063409402197               </td><td>17730                          </td><td>0.75692601477986               </td><td>ride/date/commute/peak         </td></tr>\n",
       "\t<tr><th scope=row>post_hov:IsRouteSeattle</th><td>3                              </td><td>0.135671392912957              </td><td>14.530547625522                </td><td>7.76865090485033e-13           </td><td>0.11988011988012               </td><td>-0.0321284051589282            </td><td>0.303471190984843              </td><td>-3.16177711784266              </td><td>35.4552567054475               </td><td>3613                           </td><td>0.884968096147691              </td><td>ride/date [first stop, am only]</td></tr>\n",
       "\t<tr><th scope=row>post_hov:IsRouteSeattle</th><td>4                              </td><td>0.111168305745412              </td><td>11.7582986664188               </td><td>5.68040086680928e-13           </td><td>0.105894105894106              </td><td>-0.01688176014439              </td><td>0.239218371635214              </td><td>-1.67400617250039              </td><td>27.0255894155969               </td><td>3505                           </td><td>0.929053163398893              </td><td>ride/date [last stop, am only] </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>5                              </td><td>-0.0227602150296815            </td><td>-2.25031552740639              </td><td>0.309061964825347              </td><td>0.434565434565435              </td><td>-0.0764158725914624            </td><td>0.0308954425320994             </td><td>-7.35691507629208              </td><td>3.13776600120996               </td><td>3654                           </td><td>0.949300631193809              </td><td>ride/date/commute              </td></tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/latex": [
       "\\begin{tabular}{r|llllllllllll}\n",
       "  & model & OLS Estimate & OLS Estimate (\\%) & OLS p-value & BS p-value & CI lower & CI higher & CI lower (\\%) & CI higher (\\%) & N & r2 & granularity\\\\\n",
       "\\hline\n",
       "\tpost\\_hov:IsRouteSeattle & 1                               & 0.114925524956228               & 12.1789889109745                & 1.97918934576061e-49            & 0.00299700299700301             & 0.0431243886046994              & 0.186726661307757               & 4.40677569052583                & 20.5297785499036                & 9696                            & 0.932509782055181               & ride/date/commute              \\\\\n",
       "\tpost\\_hov:IsRouteSeattle & 1                               & 0.0394574818043095              & 4.02462685502551                & 0.0536765880268809              & 0.500499500499501               & -0.0679741381336909             & 0.14688910174231                & -6.57153643908847               & 15.8225510716267                & 17730                           & 0.75692601477986                & ride/date/commute/peak         \\\\\n",
       "\tis\\_peak & 1                               & 0.903389832415144               & 146.795490109816                & 0                               & 0                               & 0.534328472563959               & 1.27245119226633                & 70.6302028813877                & 256.959160277646                & 17730                           & 0.75692601477986                & ride/date/commute/peak         \\\\\n",
       "\tis\\_peak:IsRouteSeattle & 1                               & -0.189627783146603              & -17.2733000637119               & 1.35057082748356e-26            & 0.464535464535465               & -0.67224417049056               & 0.292988604197353               & -48.9438495907608               & 34.042751509722                 & 17730                           & 0.75692601477986                & ride/date/commute/peak         \\\\\n",
       "\tis\\_peak:post\\_hov & 1                               & -0.140708481795392              & -13.1257470950524               & 7.49946199896575e-13            & 0.016983016983017               & -0.249282871639297              & -0.0321340919514867             & -22.0640516493698               & -3.16232781516207               & 17730                           & 0.75692601477986                & ride/date/commute/peak         \\\\\n",
       "\tis\\_peak:post\\_hov:IsRouteSeattle & 1                               & 0.104427004683512               & 11.0074360679448                & 0.000259168238106355            & 0.118881118881119               & -0.0262682375658352             & 0.235122246932859               & -2.59262286147461               & 26.5063409402197                & 17730                           & 0.75692601477986                & ride/date/commute/peak         \\\\\n",
       "\tpost\\_hov:IsRouteSeattle & 3                                   & 0.135671392912957                   & 14.530547625522                     & 7.76865090485033e-13                & 0.11988011988012                    & -0.0321284051589282                 & 0.303471190984843                   & -3.16177711784266                   & 35.4552567054475                    & 3613                                & 0.884968096147691                   & ride/date {[}first stop, am only{]}\\\\\n",
       "\tpost\\_hov:IsRouteSeattle & 4                                   & 0.111168305745412                   & 11.7582986664188                    & 5.68040086680928e-13                & 0.105894105894106                   & -0.01688176014439                   & 0.239218371635214                   & -1.67400617250039                   & 27.0255894155969                    & 3505                                & 0.929053163398893                   & ride/date {[}last stop, am only{]} \\\\\n",
       "\tnew\\_fraction\\_10day & 5                               & -0.0227602150296815             & -2.25031552740639               & 0.309061964825347               & 0.434565434565435               & -0.0764158725914624             & 0.0308954425320994              & -7.35691507629208               & 3.13776600120996                & 3654                            & 0.949300631193809               & ride/date/commute              \\\\\n",
       "\\end{tabular}\n"
      ],
      "text/markdown": [
       "\n",
       "| <!--/--> | model | OLS Estimate | OLS Estimate (%) | OLS p-value | BS p-value | CI lower | CI higher | CI lower (%) | CI higher (%) | N | r2 | granularity |\n",
       "|---|---|---|---|---|---|---|---|---|---|---|---|---|\n",
       "| post_hov:IsRouteSeattle | 1                               | 0.114925524956228               | 12.1789889109745                | 1.97918934576061e-49            | 0.00299700299700301             | 0.0431243886046994              | 0.186726661307757               | 4.40677569052583                | 20.5297785499036                | 9696                            | 0.932509782055181               | ride/date/commute               |\n",
       "| post_hov:IsRouteSeattle | 1                               | 0.0394574818043095              | 4.02462685502551                | 0.0536765880268809              | 0.500499500499501               | -0.0679741381336909             | 0.14688910174231                | -6.57153643908847               | 15.8225510716267                | 17730                           | 0.75692601477986                | ride/date/commute/peak          |\n",
       "| is_peak | 1                               | 0.903389832415144               | 146.795490109816                | 0                               | 0                               | 0.534328472563959               | 1.27245119226633                | 70.6302028813877                | 256.959160277646                | 17730                           | 0.75692601477986                | ride/date/commute/peak          |\n",
       "| is_peak:IsRouteSeattle | 1                               | -0.189627783146603              | -17.2733000637119               | 1.35057082748356e-26            | 0.464535464535465               | -0.67224417049056               | 0.292988604197353               | -48.9438495907608               | 34.042751509722                 | 17730                           | 0.75692601477986                | ride/date/commute/peak          |\n",
       "| is_peak:post_hov | 1                               | -0.140708481795392              | -13.1257470950524               | 7.49946199896575e-13            | 0.016983016983017               | -0.249282871639297              | -0.0321340919514867             | -22.0640516493698               | -3.16232781516207               | 17730                           | 0.75692601477986                | ride/date/commute/peak          |\n",
       "| is_peak:post_hov:IsRouteSeattle | 1                               | 0.104427004683512               | 11.0074360679448                | 0.000259168238106355            | 0.118881118881119               | -0.0262682375658352             | 0.235122246932859               | -2.59262286147461               | 26.5063409402197                | 17730                           | 0.75692601477986                | ride/date/commute/peak          |\n",
       "| post_hov:IsRouteSeattle | 3                               | 0.135671392912957               | 14.530547625522                 | 7.76865090485033e-13            | 0.11988011988012                | -0.0321284051589282             | 0.303471190984843               | -3.16177711784266               | 35.4552567054475                | 3613                            | 0.884968096147691               | ride/date [first stop, am only] |\n",
       "| post_hov:IsRouteSeattle | 4                               | 0.111168305745412               | 11.7582986664188                | 5.68040086680928e-13            | 0.105894105894106               | -0.01688176014439               | 0.239218371635214               | -1.67400617250039               | 27.0255894155969                | 3505                            | 0.929053163398893               | ride/date [last stop, am only]  |\n",
       "| new_fraction_10day | 5                               | -0.0227602150296815             | -2.25031552740639               | 0.309061964825347               | 0.434565434565435               | -0.0764158725914624             | 0.0308954425320994              | -7.35691507629208               | 3.13776600120996                | 3654                            | 0.949300631193809               | ride/date/commute               |\n",
       "\n"
      ],
      "text/plain": [
       "                                model OLS Estimate        OLS Estimate (%) \n",
       "post_hov:IsRouteSeattle         1     0.114925524956228   12.1789889109745 \n",
       "post_hov:IsRouteSeattle         1     0.0394574818043095  4.02462685502551 \n",
       "is_peak                         1     0.903389832415144   146.795490109816 \n",
       "is_peak:IsRouteSeattle          1     -0.189627783146603  -17.2733000637119\n",
       "is_peak:post_hov                1     -0.140708481795392  -13.1257470950524\n",
       "is_peak:post_hov:IsRouteSeattle 1     0.104427004683512   11.0074360679448 \n",
       "post_hov:IsRouteSeattle         3     0.135671392912957   14.530547625522  \n",
       "post_hov:IsRouteSeattle         4     0.111168305745412   11.7582986664188 \n",
       "new_fraction_10day              5     -0.0227602150296815 -2.25031552740639\n",
       "                                OLS p-value          BS p-value         \n",
       "post_hov:IsRouteSeattle         1.97918934576061e-49 0.00299700299700301\n",
       "post_hov:IsRouteSeattle         0.0536765880268809   0.500499500499501  \n",
       "is_peak                         0                    0                  \n",
       "is_peak:IsRouteSeattle          1.35057082748356e-26 0.464535464535465  \n",
       "is_peak:post_hov                7.49946199896575e-13 0.016983016983017  \n",
       "is_peak:post_hov:IsRouteSeattle 0.000259168238106355 0.118881118881119  \n",
       "post_hov:IsRouteSeattle         7.76865090485033e-13 0.11988011988012   \n",
       "post_hov:IsRouteSeattle         5.68040086680928e-13 0.105894105894106  \n",
       "new_fraction_10day              0.309061964825347    0.434565434565435  \n",
       "                                CI lower            CI higher          \n",
       "post_hov:IsRouteSeattle         0.0431243886046994  0.186726661307757  \n",
       "post_hov:IsRouteSeattle         -0.0679741381336909 0.14688910174231   \n",
       "is_peak                         0.534328472563959   1.27245119226633   \n",
       "is_peak:IsRouteSeattle          -0.67224417049056   0.292988604197353  \n",
       "is_peak:post_hov                -0.249282871639297  -0.0321340919514867\n",
       "is_peak:post_hov:IsRouteSeattle -0.0262682375658352 0.235122246932859  \n",
       "post_hov:IsRouteSeattle         -0.0321284051589282 0.303471190984843  \n",
       "post_hov:IsRouteSeattle         -0.01688176014439   0.239218371635214  \n",
       "new_fraction_10day              -0.0764158725914624 0.0308954425320994 \n",
       "                                CI lower (%)      CI higher (%)     N    \n",
       "post_hov:IsRouteSeattle         4.40677569052583  20.5297785499036  9696 \n",
       "post_hov:IsRouteSeattle         -6.57153643908847 15.8225510716267  17730\n",
       "is_peak                         70.6302028813877  256.959160277646  17730\n",
       "is_peak:IsRouteSeattle          -48.9438495907608 34.042751509722   17730\n",
       "is_peak:post_hov                -22.0640516493698 -3.16232781516207 17730\n",
       "is_peak:post_hov:IsRouteSeattle -2.59262286147461 26.5063409402197  17730\n",
       "post_hov:IsRouteSeattle         -3.16177711784266 35.4552567054475  3613 \n",
       "post_hov:IsRouteSeattle         -1.67400617250039 27.0255894155969  3505 \n",
       "new_fraction_10day              -7.35691507629208 3.13776600120996  3654 \n",
       "                                r2               \n",
       "post_hov:IsRouteSeattle         0.932509782055181\n",
       "post_hov:IsRouteSeattle         0.75692601477986 \n",
       "is_peak                         0.75692601477986 \n",
       "is_peak:IsRouteSeattle          0.75692601477986 \n",
       "is_peak:post_hov                0.75692601477986 \n",
       "is_peak:post_hov:IsRouteSeattle 0.75692601477986 \n",
       "post_hov:IsRouteSeattle         0.884968096147691\n",
       "post_hov:IsRouteSeattle         0.929053163398893\n",
       "new_fraction_10day              0.949300631193809\n",
       "                                granularity                    \n",
       "post_hov:IsRouteSeattle         ride/date/commute              \n",
       "post_hov:IsRouteSeattle         ride/date/commute/peak         \n",
       "is_peak                         ride/date/commute/peak         \n",
       "is_peak:IsRouteSeattle          ride/date/commute/peak         \n",
       "is_peak:post_hov                ride/date/commute/peak         \n",
       "is_peak:post_hov:IsRouteSeattle ride/date/commute/peak         \n",
       "post_hov:IsRouteSeattle         ride/date [first stop, am only]\n",
       "post_hov:IsRouteSeattle         ride/date [last stop, am only] \n",
       "new_fraction_10day              ride/date/commute              "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "(TABLE_3 <- do.call(rbind,lapply(TABLE_3_MODELS,function(x)x$coef)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Fit the Models for Table 4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "===============================================\n",
      "Model  1 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + fDate + fRoute\n",
      "<environment: 0x000000002dedbe18>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                     Estimate Std. Error   t value    Pr(>|t|)\n",
      "(Intercept)        3.56702186 0.07381368 48.324669 0.000000000\n",
      "new_fraction_10day 0.08527129 0.02274687  3.748705 0.000182624\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  2 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + new_fraction_10day:IsOneStop + \n",
      "    new_fraction_10day + fDate + fRoute\n",
      "<environment: 0x000000002afcdab0>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                                Estimate Std. Error    t value     Pr(>|t|)\n",
      "(Intercept)                   4.70193375 0.03048561 154.234540 0.000000e+00\n",
      "new_fraction_10day           -0.03402117 0.01086144  -3.132290 1.739787e-03\n",
      "new_fraction_10day:IsOneStop  0.08853675 0.01464269   6.046482 1.536548e-09\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  3 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + Is405North:I405HOV + new_fraction_10day:I405HOV + \n",
      "    new_fraction_10day:Is405North + new_fraction_10day:Is405North:I405HOV + \n",
      "    new_fraction_10day + fDate + fRoute\n",
      "<environment: 0x000000002a28ec00>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                                        Estimate Std. Error    t value\n",
      "(Intercept)                            4.6919115 0.03091590 151.763690\n",
      "new_fraction_10day                    -0.4847284 0.16837040  -2.878941\n",
      "Is405North:I405HOV                     0.2324587 0.03034973   7.659335\n",
      "new_fraction_10day:I405HOV             0.5137865 0.16758809   3.065770\n",
      "new_fraction_10day:Is405North          0.7298085 0.25873947   2.820631\n",
      "new_fraction_10day:Is405North:I405HOV -0.9719864 0.25900487  -3.752773\n",
      "                                          Pr(>|t|)\n",
      "(Intercept)                           0.000000e+00\n",
      "new_fraction_10day                    3.999100e-03\n",
      "Is405North:I405HOV                    2.052867e-14\n",
      "new_fraction_10day:I405HOV            2.177238e-03\n",
      "new_fraction_10day:Is405North         4.802933e-03\n",
      "new_fraction_10day:Is405North:I405HOV 1.759376e-04\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  4 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + new_fraction_10day:IsOneStop + \n",
      "    Is405North:I405HOV + new_fraction_10day:Is405North:I405HOV + \n",
      "    IsOneStop:Is405North:I405HOV + new_fraction_10day + fDate + \n",
      "    fRoute\n",
      "<environment: 0x0000000029dbe980>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                                         Estimate Std. Error     t value\n",
      "(Intercept)                            4.68535324 0.03022565 155.0124674\n",
      "new_fraction_10day                     0.01045747 0.01104109   0.9471416\n",
      "new_fraction_10day:IsOneStop           0.08116043 0.01592311   5.0970199\n",
      "Is405North:I405HOV                     0.05276498 0.02951511   1.7877278\n",
      "new_fraction_10day:Is405North:I405HOV -0.26330053 0.01882886 -13.9838807\n",
      "IsOneStop:Is405North:I405HOV           0.29807275 0.03526670   8.4519605\n",
      "                                          Pr(>|t|)\n",
      "(Intercept)                           0.000000e+00\n",
      "new_fraction_10day                    3.435909e-01\n",
      "new_fraction_10day:IsOneStop          3.517293e-07\n",
      "Is405North:I405HOV                    7.385200e-02\n",
      "new_fraction_10day:Is405North:I405HOV 5.363882e-44\n",
      "IsOneStop:Is405North:I405HOV          3.289090e-17\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n",
      "\n",
      "===============================================\n",
      "Model  5 :\n",
      "===============================================\n",
      "log(Ridership) ~ new_fraction_10day + new_fraction_10day:IsOneStop + \n",
      "    Is405North:I405HOV + new_fraction_10day:Is405North:I405HOV + \n",
      "    IsOneStop:Is405North:I405HOV + new_fraction_10day:IsOneStop:Is405North:I405HOV + \n",
      "    new_fraction_10day + fDate + fRoute\n",
      "<environment: 0x0000000030b45198>\n",
      "\n",
      "\n",
      "Coefficients from Linear model (Fixed effects omitted):\n",
      "                                                   Estimate Std. Error\n",
      "(Intercept)                                      4.68309607 0.03025233\n",
      "new_fraction_10day                               0.01469579 0.01132251\n",
      "new_fraction_10day:IsOneStop                     0.06603931 0.01827319\n",
      "Is405North:I405HOV                               0.07123313 0.03147893\n",
      "new_fraction_10day:Is405North:I405HOV           -0.28738894 0.02363314\n",
      "IsOneStop:Is405North:I405HOV                     0.25458060 0.04368916\n",
      "new_fraction_10day:IsOneStop:Is405North:I405HOV  0.06319371 0.03747605\n",
      "                                                   t value     Pr(>|t|)\n",
      "(Intercept)                                     154.801158 0.000000e+00\n",
      "new_fraction_10day                                1.297927 1.943443e-01\n",
      "new_fraction_10day:IsOneStop                      3.614000 3.030773e-04\n",
      "Is405North:I405HOV                                2.262883 2.366556e-02\n",
      "new_fraction_10day:Is405North:I405HOV           -12.160421 9.027647e-34\n",
      "IsOneStop:Is405North:I405HOV                      5.827089 5.825045e-09\n",
      "new_fraction_10day:IsOneStop:Is405North:I405HOV   1.686243 9.178214e-02\n",
      "\n",
      " \n",
      " Note: null not imposed (factor variables are present). \n",
      "Wild Cluster bootstrapping w/o imposing null... \n",
      "  |======================================================================| 100%\n"
     ]
    }
   ],
   "source": [
    "TABLE_4_MODELS <- list(\n",
    "    \n",
    "        M1 = fit_ridership_counts_models(data = ride_date_commute_counts[(IsOneStop == 1)],\n",
    "                                    random=c(\"new_fraction_10day\"),\n",
    "                                    fixed=\"fDate + fRoute\",\n",
    "                                    model=1,\n",
    "                                    granularity=\"ride/date/commute [One Stop Only]\"),\n",
    "    \n",
    "        M2 = fit_ridership_counts_models(data = ride_date_commute_counts,\n",
    "                                    random=c(\"new_fraction_10day\",\n",
    "                                             \"new_fraction_10day:IsOneStop\"\n",
    "                                            ),\n",
    "                                    fixed=\"new_fraction_10day + fDate + fRoute\",\n",
    "                                    model=2,\n",
    "                                    granularity=\"ride/date/commute/peak\"),\n",
    "    \n",
    "        M3 = fit_ridership_counts_models(data = ride_date_commute_counts,\n",
    "                                    random=c(\n",
    "                                            \"new_fraction_10day\",\n",
    "                                            \"Is405North:I405HOV\",\n",
    "                                            \"new_fraction_10day:I405HOV\",\n",
    "                                            \"new_fraction_10day:Is405North\",\n",
    "                                            \"new_fraction_10day:Is405North:I405HOV\"\n",
    "                                            ),\n",
    "                                    fixed=\"new_fraction_10day + fDate + fRoute\",\n",
    "                                    model=3,\n",
    "                                    granularity=\"ride/date [first stop, am only]\"),\n",
    "\n",
    "        M4 = fit_ridership_counts_models(data = ride_date_commute_counts,\n",
    "                                    random=c(\n",
    "                                            \"new_fraction_10day\",\n",
    "                                            \"new_fraction_10day:IsOneStop\",\n",
    "                                            \"Is405North:I405HOV\",\n",
    "                                            \"new_fraction_10day:Is405North:I405HOV\",\n",
    "                                            \"IsOneStop:Is405North:I405HOV\"\n",
    "                                            ),\n",
    "                                    fixed=\"new_fraction_10day + fDate + fRoute\",\n",
    "                                    model=4,\n",
    "                                    granularity=\"ride/date [first stop, am only]\"),\n",
    "\n",
    "        M5 = fit_ridership_counts_models(data = ride_date_commute_counts,\n",
    "                                    random=c(\n",
    "                                            \"new_fraction_10day\",\n",
    "                                            \"new_fraction_10day:IsOneStop\",\n",
    "                                            \"Is405North:I405HOV\",\n",
    "                                            \"new_fraction_10day:Is405North:I405HOV\",\n",
    "                                            \"IsOneStop:Is405North:I405HOV\",\n",
    "                                            \"new_fraction_10day:IsOneStop:Is405North:I405HOV\"\n",
    "                                            ),\n",
    "                                    fixed=\"new_fraction_10day + fDate + fRoute\",\n",
    "                                    model=5,\n",
    "                                    granularity=\"ride/date [first stop, am only]\")\n",
    "                                    )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Table 4 Summary Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<table>\n",
       "<thead><tr><th></th><th scope=col>model</th><th scope=col>OLS Estimate</th><th scope=col>OLS Estimate (%)</th><th scope=col>OLS p-value</th><th scope=col>BS p-value</th><th scope=col>CI lower</th><th scope=col>CI higher</th><th scope=col>CI lower (%)</th><th scope=col>CI higher (%)</th><th scope=col>N</th><th scope=col>r2</th><th scope=col>granularity</th></tr></thead>\n",
       "<tbody>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>1                                </td><td>0.0852712879916381               </td><td>8.90124626317585                 </td><td>0.000182623997245142             </td><td>0.240759240759241                </td><td>-0.0759226176960202              </td><td>0.246465193679296                </td><td>-7.31120714922194                </td><td>27.9494647941498                 </td><td>2306                             </td><td>0.845364085326039                </td><td>ride/date/commute [One Stop Only]</td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>2                                </td><td>-0.0340211748364555              </td><td>-3.34489621393355                </td><td>0.00173978659062503              </td><td>0.396603396603397                </td><td>-0.123383697664346               </td><td>0.0553413479914355               </td><td>-11.6075562257123                </td><td>5.69013242524261                 </td><td>9696                             </td><td>0.930844346463872                </td><td>ride/date/commute/peak           </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:IsOneStop</th><td>2                                </td><td>0.0885367464532645               </td><td>9.25744001069673                 </td><td>1.53654770404436e-09             </td><td>0.313686313686314                </td><td>-0.169862825069045               </td><td>0.346936317975574                </td><td>-15.6219445802683                </td><td>41.4726629845928                 </td><td>9696                             </td><td>0.930844346463872                </td><td>ride/date/commute/peak           </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>3                                </td><td>-0.484728385639717               </td><td>-38.4135548322098                </td><td>0.00399909985168846              </td><td>0.227772227772228                </td><td>-1.20989682154376                </td><td>0.240440050264322                </td><td>-70.1771951447837                </td><td>27.1808686949114                 </td><td>9696                             </td><td>0.931879735970304                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>Is405North:I405HOV</th><td>3                                </td><td>0.232458749084667                </td><td>26.1698399071659                 </td><td>2.05286669970782e-14             </td><td>0.235764235764236                </td><td>-0.130237276910847               </td><td>0.595154775080182                </td><td>-12.2112896134139                </td><td>81.3311578687028                 </td><td>9696                             </td><td>0.931879735970304                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:I405HOV</th><td>3                                </td><td>0.513786530632859                </td><td>67.1608824468622                 </td><td>0.00217723781487582              </td><td>0.236763236763237                </td><td>-0.287492754945449               </td><td>1.31506581621117                 </td><td>-24.9857998428984                </td><td>272.499614231617                 </td><td>9696                             </td><td>0.931879735970304                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:Is405North</th><td>3                                </td><td>0.729808498496612                </td><td>107.468326466521                 </td><td>0.00480293276219393              </td><td>0.200799200799201                </td><td>-0.50468472932029                </td><td>1.96430172631351                 </td><td>-39.6304126963934                </td><td>612.99322074788                  </td><td>9696                             </td><td>0.931879735970304                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:Is405North:I405HOV</th><td>3                                </td><td>-0.971986440714433               </td><td>-62.1669240451894                </td><td>0.000175937634394908             </td><td>0.103896103896104                </td><td>-2.2034013605089                 </td><td>0.259428479080033                </td><td>-88.9573082895966                </td><td>29.6189075761295                 </td><td>9696                             </td><td>0.931879735970304                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>4                                </td><td>0.0104574709021799               </td><td>1.05123413529307                 </td><td>0.343590885508587                </td><td>0.762237762237762                </td><td>-0.0572840108084649              </td><td>0.0781989526128248               </td><td>-5.56741674659057                </td><td>8.1337772245804                  </td><td>9696                             </td><td>0.932837721318863                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:IsOneStop</th><td>4                                </td><td>0.0811604313023674               </td><td>8.45448775575712                 </td><td>3.51729313076634e-07             </td><td>0.481518481518482                </td><td>-0.235692863486449               </td><td>0.398013726091184                </td><td>-20.9976718329596                </td><td>48.8864466056445                 </td><td>9696                             </td><td>0.932837721318863                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>Is405North:I405HOV</th><td>4                                </td><td>0.0527649755486895               </td><td>5.41818574897825                 </td><td>0.0738520038561686               </td><td>0.383616383616384                </td><td>-0.0475104782400835              </td><td>0.153040429337463                </td><td>-4.63995189745073                </td><td>16.5372093211958                 </td><td>9696                             </td><td>0.932837721318863                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:Is405North:I405HOV</th><td>4                                </td><td>-0.263300529215056               </td><td>-23.1489097375755                </td><td>5.36388227137846e-44             </td><td>0.00499500499500505              </td><td>-0.445340892583761               </td><td>-0.0812601658463512              </td><td>-35.9394138980731                </td><td>-7.80462006504082                </td><td>9696                             </td><td>0.932837721318863                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>IsOneStop:Is405North:I405HOV</th><td>4                                </td><td>0.2980727545508                  </td><td>34.7259803595788                 </td><td>3.28908977947487e-17             </td><td>0.398601398601399                </td><td>-0.862438510221652               </td><td>1.45858401932325                 </td><td>-57.7868545636294                </td><td>329.986668754864                 </td><td>9696                             </td><td>0.932837721318863                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day</th><td>5                                </td><td>0.0146957900533885               </td><td>1.480430409092                   </td><td>0.194344281663618                </td><td>0.692307692307692                </td><td>-0.0569239929516739              </td><td>0.0863155730584508               </td><td>-5.53341320978349                </td><td>9.01502960918996                 </td><td>9696                             </td><td>0.932857947258507                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:IsOneStop</th><td>5                                </td><td>0.0660393080938988               </td><td>6.82687079473803                 </td><td>0.000303077296769632             </td><td>0.51048951048951                 </td><td>-0.383351686501222               </td><td>0.51543030268902                 </td><td>-31.8426842947523                </td><td>67.4358827913317                 </td><td>9696                             </td><td>0.932857947258507                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>Is405North:I405HOV</th><td>5                                </td><td>0.0712331271638643               </td><td>7.38315359906327                 </td><td>0.0236655550774221               </td><td>0.0369630369630369               </td><td>0.00337728215132634              </td><td>0.139088972176402                </td><td>0.338299159434841                </td><td>14.9226344624134                 </td><td>9696                             </td><td>0.932857947258507                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:Is405North:I405HOV</th><td>5                                </td><td>-0.287388941670899               </td><td>-24.978011968907                 </td><td>9.02764731708407e-34             </td><td>0.037962037962038                </td><td>-0.560266251785018               </td><td>-0.0145116315567811              </td><td>-42.8943001339341                </td><td>-1.44068453170316                </td><td>9696                             </td><td>0.932857947258507                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>IsOneStop:Is405North:I405HOV</th><td>5                                </td><td>0.254580603302313                </td><td>28.9920519006703                 </td><td>5.82504531135404e-09             </td><td>0.492507492507492                </td><td>-0.980244302909653               </td><td>1.48940550951428                 </td><td>-62.478057954297                 </td><td>343.445849185482                 </td><td>9696                             </td><td>0.932857947258507                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "\t<tr><th scope=row>new_fraction_10day:IsOneStop:Is405North:I405HOV</th><td>5                                </td><td>0.0631937103467172               </td><td>6.52331659327594                 </td><td>0.091782143358445                </td><td>0.709290709290709                </td><td>-0.457532417786034               </td><td>0.583919838479468                </td><td>-36.7156686684578                </td><td>79.3053152222469                 </td><td>9696                             </td><td>0.932857947258507                </td><td>ride/date [first stop, am only]  </td></tr>\n",
       "</tbody>\n",
       "</table>\n"
      ],
      "text/latex": [
       "\\begin{tabular}{r|llllllllllll}\n",
       "  & model & OLS Estimate & OLS Estimate (\\%) & OLS p-value & BS p-value & CI lower & CI higher & CI lower (\\%) & CI higher (\\%) & N & r2 & granularity\\\\\n",
       "\\hline\n",
       "\tnew\\_fraction\\_10day & 1                                     & 0.0852712879916381                    & 8.90124626317585                      & 0.000182623997245142                  & 0.240759240759241                     & -0.0759226176960202                   & 0.246465193679296                     & -7.31120714922194                     & 27.9494647941498                      & 2306                                  & 0.845364085326039                     & ride/date/commute {[}One Stop Only{]}\\\\\n",
       "\tnew\\_fraction\\_10day & 2                                 & -0.0340211748364555               & -3.34489621393355                 & 0.00173978659062503               & 0.396603396603397                 & -0.123383697664346                & 0.0553413479914355                & -11.6075562257123                 & 5.69013242524261                  & 9696                              & 0.930844346463872                 & ride/date/commute/peak           \\\\\n",
       "\tnew\\_fraction\\_10day:IsOneStop & 2                                 & 0.0885367464532645                & 9.25744001069673                  & 1.53654770404436e-09              & 0.313686313686314                 & -0.169862825069045                & 0.346936317975574                 & -15.6219445802683                 & 41.4726629845928                  & 9696                              & 0.930844346463872                 & ride/date/commute/peak           \\\\\n",
       "\tnew\\_fraction\\_10day & 3                                     & -0.484728385639717                    & -38.4135548322098                     & 0.00399909985168846                   & 0.227772227772228                     & -1.20989682154376                     & 0.240440050264322                     & -70.1771951447837                     & 27.1808686949114                      & 9696                                  & 0.931879735970304                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tIs405North:I405HOV & 3                                     & 0.232458749084667                     & 26.1698399071659                      & 2.05286669970782e-14                  & 0.235764235764236                     & -0.130237276910847                    & 0.595154775080182                     & -12.2112896134139                     & 81.3311578687028                      & 9696                                  & 0.931879735970304                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tnew\\_fraction\\_10day:I405HOV & 3                                     & 0.513786530632859                     & 67.1608824468622                      & 0.00217723781487582                   & 0.236763236763237                     & -0.287492754945449                    & 1.31506581621117                      & -24.9857998428984                     & 272.499614231617                      & 9696                                  & 0.931879735970304                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tnew\\_fraction\\_10day:Is405North & 3                                     & 0.729808498496612                     & 107.468326466521                      & 0.00480293276219393                   & 0.200799200799201                     & -0.50468472932029                     & 1.96430172631351                      & -39.6304126963934                     & 612.99322074788                       & 9696                                  & 0.931879735970304                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tnew\\_fraction\\_10day:Is405North:I405HOV & 3                                     & -0.971986440714433                    & -62.1669240451894                     & 0.000175937634394908                  & 0.103896103896104                     & -2.2034013605089                      & 0.259428479080033                     & -88.9573082895966                     & 29.6189075761295                      & 9696                                  & 0.931879735970304                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tnew\\_fraction\\_10day & 4                                     & 0.0104574709021799                    & 1.05123413529307                      & 0.343590885508587                     & 0.762237762237762                     & -0.0572840108084649                   & 0.0781989526128248                    & -5.56741674659057                     & 8.1337772245804                       & 9696                                  & 0.932837721318863                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tnew\\_fraction\\_10day:IsOneStop & 4                                     & 0.0811604313023674                    & 8.45448775575712                      & 3.51729313076634e-07                  & 0.481518481518482                     & -0.235692863486449                    & 0.398013726091184                     & -20.9976718329596                     & 48.8864466056445                      & 9696                                  & 0.932837721318863                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tIs405North:I405HOV & 4                                     & 0.0527649755486895                    & 5.41818574897825                      & 0.0738520038561686                    & 0.383616383616384                     & -0.0475104782400835                   & 0.153040429337463                     & -4.63995189745073                     & 16.5372093211958                      & 9696                                  & 0.932837721318863                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tnew\\_fraction\\_10day:Is405North:I405HOV & 4                                     & -0.263300529215056                    & -23.1489097375755                     & 5.36388227137846e-44                  & 0.00499500499500505                   & -0.445340892583761                    & -0.0812601658463512                   & -35.9394138980731                     & -7.80462006504082                     & 9696                                  & 0.932837721318863                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tIsOneStop:Is405North:I405HOV & 4                                     & 0.2980727545508                       & 34.7259803595788                      & 3.28908977947487e-17                  & 0.398601398601399                     & -0.862438510221652                    & 1.45858401932325                      & -57.7868545636294                     & 329.986668754864                      & 9696                                  & 0.932837721318863                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tnew\\_fraction\\_10day & 5                                     & 0.0146957900533885                    & 1.480430409092                        & 0.194344281663618                     & 0.692307692307692                     & -0.0569239929516739                   & 0.0863155730584508                    & -5.53341320978349                     & 9.01502960918996                      & 9696                                  & 0.932857947258507                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tnew\\_fraction\\_10day:IsOneStop & 5                                     & 0.0660393080938988                    & 6.82687079473803                      & 0.000303077296769632                  & 0.51048951048951                      & -0.383351686501222                    & 0.51543030268902                      & -31.8426842947523                     & 67.4358827913317                      & 9696                                  & 0.932857947258507                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tIs405North:I405HOV & 5                                     & 0.0712331271638643                    & 7.38315359906327                      & 0.0236655550774221                    & 0.0369630369630369                    & 0.00337728215132634                   & 0.139088972176402                     & 0.338299159434841                     & 14.9226344624134                      & 9696                                  & 0.932857947258507                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tnew\\_fraction\\_10day:Is405North:I405HOV & 5                                     & -0.287388941670899                    & -24.978011968907                      & 9.02764731708407e-34                  & 0.037962037962038                     & -0.560266251785018                    & -0.0145116315567811                   & -42.8943001339341                     & -1.44068453170316                     & 9696                                  & 0.932857947258507                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tIsOneStop:Is405North:I405HOV & 5                                     & 0.254580603302313                     & 28.9920519006703                      & 5.82504531135404e-09                  & 0.492507492507492                     & -0.980244302909653                    & 1.48940550951428                      & -62.478057954297                      & 343.445849185482                      & 9696                                  & 0.932857947258507                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\tnew\\_fraction\\_10day:IsOneStop:Is405North:I405HOV & 5                                     & 0.0631937103467172                    & 6.52331659327594                      & 0.091782143358445                     & 0.709290709290709                     & -0.457532417786034                    & 0.583919838479468                     & -36.7156686684578                     & 79.3053152222469                      & 9696                                  & 0.932857947258507                     & ride/date {[}first stop, am only{]}  \\\\\n",
       "\\end{tabular}\n"
      ],
      "text/markdown": [
       "\n",
       "| <!--/--> | model | OLS Estimate | OLS Estimate (%) | OLS p-value | BS p-value | CI lower | CI higher | CI lower (%) | CI higher (%) | N | r2 | granularity |\n",
       "|---|---|---|---|---|---|---|---|---|---|---|---|---|\n",
       "| new_fraction_10day | 1                                 | 0.0852712879916381                | 8.90124626317585                  | 0.000182623997245142              | 0.240759240759241                 | -0.0759226176960202               | 0.246465193679296                 | -7.31120714922194                 | 27.9494647941498                  | 2306                              | 0.845364085326039                 | ride/date/commute [One Stop Only] |\n",
       "| new_fraction_10day | 2                                 | -0.0340211748364555               | -3.34489621393355                 | 0.00173978659062503               | 0.396603396603397                 | -0.123383697664346                | 0.0553413479914355                | -11.6075562257123                 | 5.69013242524261                  | 9696                              | 0.930844346463872                 | ride/date/commute/peak            |\n",
       "| new_fraction_10day:IsOneStop | 2                                 | 0.0885367464532645                | 9.25744001069673                  | 1.53654770404436e-09              | 0.313686313686314                 | -0.169862825069045                | 0.346936317975574                 | -15.6219445802683                 | 41.4726629845928                  | 9696                              | 0.930844346463872                 | ride/date/commute/peak            |\n",
       "| new_fraction_10day | 3                                 | -0.484728385639717                | -38.4135548322098                 | 0.00399909985168846               | 0.227772227772228                 | -1.20989682154376                 | 0.240440050264322                 | -70.1771951447837                 | 27.1808686949114                  | 9696                              | 0.931879735970304                 | ride/date [first stop, am only]   |\n",
       "| Is405North:I405HOV | 3                                 | 0.232458749084667                 | 26.1698399071659                  | 2.05286669970782e-14              | 0.235764235764236                 | -0.130237276910847                | 0.595154775080182                 | -12.2112896134139                 | 81.3311578687028                  | 9696                              | 0.931879735970304                 | ride/date [first stop, am only]   |\n",
       "| new_fraction_10day:I405HOV | 3                                 | 0.513786530632859                 | 67.1608824468622                  | 0.00217723781487582               | 0.236763236763237                 | -0.287492754945449                | 1.31506581621117                  | -24.9857998428984                 | 272.499614231617                  | 9696                              | 0.931879735970304                 | ride/date [first stop, am only]   |\n",
       "| new_fraction_10day:Is405North | 3                                 | 0.729808498496612                 | 107.468326466521                  | 0.00480293276219393               | 0.200799200799201                 | -0.50468472932029                 | 1.96430172631351                  | -39.6304126963934                 | 612.99322074788                   | 9696                              | 0.931879735970304                 | ride/date [first stop, am only]   |\n",
       "| new_fraction_10day:Is405North:I405HOV | 3                                 | -0.971986440714433                | -62.1669240451894                 | 0.000175937634394908              | 0.103896103896104                 | -2.2034013605089                  | 0.259428479080033                 | -88.9573082895966                 | 29.6189075761295                  | 9696                              | 0.931879735970304                 | ride/date [first stop, am only]   |\n",
       "| new_fraction_10day | 4                                 | 0.0104574709021799                | 1.05123413529307                  | 0.343590885508587                 | 0.762237762237762                 | -0.0572840108084649               | 0.0781989526128248                | -5.56741674659057                 | 8.1337772245804                   | 9696                              | 0.932837721318863                 | ride/date [first stop, am only]   |\n",
       "| new_fraction_10day:IsOneStop | 4                                 | 0.0811604313023674                | 8.45448775575712                  | 3.51729313076634e-07              | 0.481518481518482                 | -0.235692863486449                | 0.398013726091184                 | -20.9976718329596                 | 48.8864466056445                  | 9696                              | 0.932837721318863                 | ride/date [first stop, am only]   |\n",
       "| Is405North:I405HOV | 4                                 | 0.0527649755486895                | 5.41818574897825                  | 0.0738520038561686                | 0.383616383616384                 | -0.0475104782400835               | 0.153040429337463                 | -4.63995189745073                 | 16.5372093211958                  | 9696                              | 0.932837721318863                 | ride/date [first stop, am only]   |\n",
       "| new_fraction_10day:Is405North:I405HOV | 4                                 | -0.263300529215056                | -23.1489097375755                 | 5.36388227137846e-44              | 0.00499500499500505               | -0.445340892583761                | -0.0812601658463512               | -35.9394138980731                 | -7.80462006504082                 | 9696                              | 0.932837721318863                 | ride/date [first stop, am only]   |\n",
       "| IsOneStop:Is405North:I405HOV | 4                                 | 0.2980727545508                   | 34.7259803595788                  | 3.28908977947487e-17              | 0.398601398601399                 | -0.862438510221652                | 1.45858401932325                  | -57.7868545636294                 | 329.986668754864                  | 9696                              | 0.932837721318863                 | ride/date [first stop, am only]   |\n",
       "| new_fraction_10day | 5                                 | 0.0146957900533885                | 1.480430409092                    | 0.194344281663618                 | 0.692307692307692                 | -0.0569239929516739               | 0.0863155730584508                | -5.53341320978349                 | 9.01502960918996                  | 9696                              | 0.932857947258507                 | ride/date [first stop, am only]   |\n",
       "| new_fraction_10day:IsOneStop | 5                                 | 0.0660393080938988                | 6.82687079473803                  | 0.000303077296769632              | 0.51048951048951                  | -0.383351686501222                | 0.51543030268902                  | -31.8426842947523                 | 67.4358827913317                  | 9696                              | 0.932857947258507                 | ride/date [first stop, am only]   |\n",
       "| Is405North:I405HOV | 5                                 | 0.0712331271638643                | 7.38315359906327                  | 0.0236655550774221                | 0.0369630369630369                | 0.00337728215132634               | 0.139088972176402                 | 0.338299159434841                 | 14.9226344624134                  | 9696                              | 0.932857947258507                 | ride/date [first stop, am only]   |\n",
       "| new_fraction_10day:Is405North:I405HOV | 5                                 | -0.287388941670899                | -24.978011968907                  | 9.02764731708407e-34              | 0.037962037962038                 | -0.560266251785018                | -0.0145116315567811               | -42.8943001339341                 | -1.44068453170316                 | 9696                              | 0.932857947258507                 | ride/date [first stop, am only]   |\n",
       "| IsOneStop:Is405North:I405HOV | 5                                 | 0.254580603302313                 | 28.9920519006703                  | 5.82504531135404e-09              | 0.492507492507492                 | -0.980244302909653                | 1.48940550951428                  | -62.478057954297                  | 343.445849185482                  | 9696                              | 0.932857947258507                 | ride/date [first stop, am only]   |\n",
       "| new_fraction_10day:IsOneStop:Is405North:I405HOV | 5                                 | 0.0631937103467172                | 6.52331659327594                  | 0.091782143358445                 | 0.709290709290709                 | -0.457532417786034                | 0.583919838479468                 | -36.7156686684578                 | 79.3053152222469                  | 9696                              | 0.932857947258507                 | ride/date [first stop, am only]   |\n",
       "\n"
      ],
      "text/plain": [
       "                                                model OLS Estimate       \n",
       "new_fraction_10day                              1     0.0852712879916381 \n",
       "new_fraction_10day                              2     -0.0340211748364555\n",
       "new_fraction_10day:IsOneStop                    2     0.0885367464532645 \n",
       "new_fraction_10day                              3     -0.484728385639717 \n",
       "Is405North:I405HOV                              3     0.232458749084667  \n",
       "new_fraction_10day:I405HOV                      3     0.513786530632859  \n",
       "new_fraction_10day:Is405North                   3     0.729808498496612  \n",
       "new_fraction_10day:Is405North:I405HOV           3     -0.971986440714433 \n",
       "new_fraction_10day                              4     0.0104574709021799 \n",
       "new_fraction_10day:IsOneStop                    4     0.0811604313023674 \n",
       "Is405North:I405HOV                              4     0.0527649755486895 \n",
       "new_fraction_10day:Is405North:I405HOV           4     -0.263300529215056 \n",
       "IsOneStop:Is405North:I405HOV                    4     0.2980727545508    \n",
       "new_fraction_10day                              5     0.0146957900533885 \n",
       "new_fraction_10day:IsOneStop                    5     0.0660393080938988 \n",
       "Is405North:I405HOV                              5     0.0712331271638643 \n",
       "new_fraction_10day:Is405North:I405HOV           5     -0.287388941670899 \n",
       "IsOneStop:Is405North:I405HOV                    5     0.254580603302313  \n",
       "new_fraction_10day:IsOneStop:Is405North:I405HOV 5     0.0631937103467172 \n",
       "                                                OLS Estimate (%) \n",
       "new_fraction_10day                              8.90124626317585 \n",
       "new_fraction_10day                              -3.34489621393355\n",
       "new_fraction_10day:IsOneStop                    9.25744001069673 \n",
       "new_fraction_10day                              -38.4135548322098\n",
       "Is405North:I405HOV                              26.1698399071659 \n",
       "new_fraction_10day:I405HOV                      67.1608824468622 \n",
       "new_fraction_10day:Is405North                   107.468326466521 \n",
       "new_fraction_10day:Is405North:I405HOV           -62.1669240451894\n",
       "new_fraction_10day                              1.05123413529307 \n",
       "new_fraction_10day:IsOneStop                    8.45448775575712 \n",
       "Is405North:I405HOV                              5.41818574897825 \n",
       "new_fraction_10day:Is405North:I405HOV           -23.1489097375755\n",
       "IsOneStop:Is405North:I405HOV                    34.7259803595788 \n",
       "new_fraction_10day                              1.480430409092   \n",
       "new_fraction_10day:IsOneStop                    6.82687079473803 \n",
       "Is405North:I405HOV                              7.38315359906327 \n",
       "new_fraction_10day:Is405North:I405HOV           -24.978011968907 \n",
       "IsOneStop:Is405North:I405HOV                    28.9920519006703 \n",
       "new_fraction_10day:IsOneStop:Is405North:I405HOV 6.52331659327594 \n",
       "                                                OLS p-value         \n",
       "new_fraction_10day                              0.000182623997245142\n",
       "new_fraction_10day                              0.00173978659062503 \n",
       "new_fraction_10day:IsOneStop                    1.53654770404436e-09\n",
       "new_fraction_10day                              0.00399909985168846 \n",
       "Is405North:I405HOV                              2.05286669970782e-14\n",
       "new_fraction_10day:I405HOV                      0.00217723781487582 \n",
       "new_fraction_10day:Is405North                   0.00480293276219393 \n",
       "new_fraction_10day:Is405North:I405HOV           0.000175937634394908\n",
       "new_fraction_10day                              0.343590885508587   \n",
       "new_fraction_10day:IsOneStop                    3.51729313076634e-07\n",
       "Is405North:I405HOV                              0.0738520038561686  \n",
       "new_fraction_10day:Is405North:I405HOV           5.36388227137846e-44\n",
       "IsOneStop:Is405North:I405HOV                    3.28908977947487e-17\n",
       "new_fraction_10day                              0.194344281663618   \n",
       "new_fraction_10day:IsOneStop                    0.000303077296769632\n",
       "Is405North:I405HOV                              0.0236655550774221  \n",
       "new_fraction_10day:Is405North:I405HOV           9.02764731708407e-34\n",
       "IsOneStop:Is405North:I405HOV                    5.82504531135404e-09\n",
       "new_fraction_10day:IsOneStop:Is405North:I405HOV 0.091782143358445   \n",
       "                                                BS p-value         \n",
       "new_fraction_10day                              0.240759240759241  \n",
       "new_fraction_10day                              0.396603396603397  \n",
       "new_fraction_10day:IsOneStop                    0.313686313686314  \n",
       "new_fraction_10day                              0.227772227772228  \n",
       "Is405North:I405HOV                              0.235764235764236  \n",
       "new_fraction_10day:I405HOV                      0.236763236763237  \n",
       "new_fraction_10day:Is405North                   0.200799200799201  \n",
       "new_fraction_10day:Is405North:I405HOV           0.103896103896104  \n",
       "new_fraction_10day                              0.762237762237762  \n",
       "new_fraction_10day:IsOneStop                    0.481518481518482  \n",
       "Is405North:I405HOV                              0.383616383616384  \n",
       "new_fraction_10day:Is405North:I405HOV           0.00499500499500505\n",
       "IsOneStop:Is405North:I405HOV                    0.398601398601399  \n",
       "new_fraction_10day                              0.692307692307692  \n",
       "new_fraction_10day:IsOneStop                    0.51048951048951   \n",
       "Is405North:I405HOV                              0.0369630369630369 \n",
       "new_fraction_10day:Is405North:I405HOV           0.037962037962038  \n",
       "IsOneStop:Is405North:I405HOV                    0.492507492507492  \n",
       "new_fraction_10day:IsOneStop:Is405North:I405HOV 0.709290709290709  \n",
       "                                                CI lower           \n",
       "new_fraction_10day                              -0.0759226176960202\n",
       "new_fraction_10day                              -0.123383697664346 \n",
       "new_fraction_10day:IsOneStop                    -0.169862825069045 \n",
       "new_fraction_10day                              -1.20989682154376  \n",
       "Is405North:I405HOV                              -0.130237276910847 \n",
       "new_fraction_10day:I405HOV                      -0.287492754945449 \n",
       "new_fraction_10day:Is405North                   -0.50468472932029  \n",
       "new_fraction_10day:Is405North:I405HOV           -2.2034013605089   \n",
       "new_fraction_10day                              -0.0572840108084649\n",
       "new_fraction_10day:IsOneStop                    -0.235692863486449 \n",
       "Is405North:I405HOV                              -0.0475104782400835\n",
       "new_fraction_10day:Is405North:I405HOV           -0.445340892583761 \n",
       "IsOneStop:Is405North:I405HOV                    -0.862438510221652 \n",
       "new_fraction_10day                              -0.0569239929516739\n",
       "new_fraction_10day:IsOneStop                    -0.383351686501222 \n",
       "Is405North:I405HOV                              0.00337728215132634\n",
       "new_fraction_10day:Is405North:I405HOV           -0.560266251785018 \n",
       "IsOneStop:Is405North:I405HOV                    -0.980244302909653 \n",
       "new_fraction_10day:IsOneStop:Is405North:I405HOV -0.457532417786034 \n",
       "                                                CI higher          \n",
       "new_fraction_10day                              0.246465193679296  \n",
       "new_fraction_10day                              0.0553413479914355 \n",
       "new_fraction_10day:IsOneStop                    0.346936317975574  \n",
       "new_fraction_10day                              0.240440050264322  \n",
       "Is405North:I405HOV                              0.595154775080182  \n",
       "new_fraction_10day:I405HOV                      1.31506581621117   \n",
       "new_fraction_10day:Is405North                   1.96430172631351   \n",
       "new_fraction_10day:Is405North:I405HOV           0.259428479080033  \n",
       "new_fraction_10day                              0.0781989526128248 \n",
       "new_fraction_10day:IsOneStop                    0.398013726091184  \n",
       "Is405North:I405HOV                              0.153040429337463  \n",
       "new_fraction_10day:Is405North:I405HOV           -0.0812601658463512\n",
       "IsOneStop:Is405North:I405HOV                    1.45858401932325   \n",
       "new_fraction_10day                              0.0863155730584508 \n",
       "new_fraction_10day:IsOneStop                    0.51543030268902   \n",
       "Is405North:I405HOV                              0.139088972176402  \n",
       "new_fraction_10day:Is405North:I405HOV           -0.0145116315567811\n",
       "IsOneStop:Is405North:I405HOV                    1.48940550951428   \n",
       "new_fraction_10day:IsOneStop:Is405North:I405HOV 0.583919838479468  \n",
       "                                                CI lower (%)     \n",
       "new_fraction_10day                              -7.31120714922194\n",
       "new_fraction_10day                              -11.6075562257123\n",
       "new_fraction_10day:IsOneStop                    -15.6219445802683\n",
       "new_fraction_10day                              -70.1771951447837\n",
       "Is405North:I405HOV                              -12.2112896134139\n",
       "new_fraction_10day:I405HOV                      -24.9857998428984\n",
       "new_fraction_10day:Is405North                   -39.6304126963934\n",
       "new_fraction_10day:Is405North:I405HOV           -88.9573082895966\n",
       "new_fraction_10day                              -5.56741674659057\n",
       "new_fraction_10day:IsOneStop                    -20.9976718329596\n",
       "Is405North:I405HOV                              -4.63995189745073\n",
       "new_fraction_10day:Is405North:I405HOV           -35.9394138980731\n",
       "IsOneStop:Is405North:I405HOV                    -57.7868545636294\n",
       "new_fraction_10day                              -5.53341320978349\n",
       "new_fraction_10day:IsOneStop                    -31.8426842947523\n",
       "Is405North:I405HOV                              0.338299159434841\n",
       "new_fraction_10day:Is405North:I405HOV           -42.8943001339341\n",
       "IsOneStop:Is405North:I405HOV                    -62.478057954297 \n",
       "new_fraction_10day:IsOneStop:Is405North:I405HOV -36.7156686684578\n",
       "                                                CI higher (%)     N   \n",
       "new_fraction_10day                              27.9494647941498  2306\n",
       "new_fraction_10day                              5.69013242524261  9696\n",
       "new_fraction_10day:IsOneStop                    41.4726629845928  9696\n",
       "new_fraction_10day                              27.1808686949114  9696\n",
       "Is405North:I405HOV                              81.3311578687028  9696\n",
       "new_fraction_10day:I405HOV                      272.499614231617  9696\n",
       "new_fraction_10day:Is405North                   612.99322074788   9696\n",
       "new_fraction_10day:Is405North:I405HOV           29.6189075761295  9696\n",
       "new_fraction_10day                              8.1337772245804   9696\n",
       "new_fraction_10day:IsOneStop                    48.8864466056445  9696\n",
       "Is405North:I405HOV                              16.5372093211958  9696\n",
       "new_fraction_10day:Is405North:I405HOV           -7.80462006504082 9696\n",
       "IsOneStop:Is405North:I405HOV                    329.986668754864  9696\n",
       "new_fraction_10day                              9.01502960918996  9696\n",
       "new_fraction_10day:IsOneStop                    67.4358827913317  9696\n",
       "Is405North:I405HOV                              14.9226344624134  9696\n",
       "new_fraction_10day:Is405North:I405HOV           -1.44068453170316 9696\n",
       "IsOneStop:Is405North:I405HOV                    343.445849185482  9696\n",
       "new_fraction_10day:IsOneStop:Is405North:I405HOV 79.3053152222469  9696\n",
       "                                                r2               \n",
       "new_fraction_10day                              0.845364085326039\n",
       "new_fraction_10day                              0.930844346463872\n",
       "new_fraction_10day:IsOneStop                    0.930844346463872\n",
       "new_fraction_10day                              0.931879735970304\n",
       "Is405North:I405HOV                              0.931879735970304\n",
       "new_fraction_10day:I405HOV                      0.931879735970304\n",
       "new_fraction_10day:Is405North                   0.931879735970304\n",
       "new_fraction_10day:Is405North:I405HOV           0.931879735970304\n",
       "new_fraction_10day                              0.932837721318863\n",
       "new_fraction_10day:IsOneStop                    0.932837721318863\n",
       "Is405North:I405HOV                              0.932837721318863\n",
       "new_fraction_10day:Is405North:I405HOV           0.932837721318863\n",
       "IsOneStop:Is405North:I405HOV                    0.932837721318863\n",
       "new_fraction_10day                              0.932857947258507\n",
       "new_fraction_10day:IsOneStop                    0.932857947258507\n",
       "Is405North:I405HOV                              0.932857947258507\n",
       "new_fraction_10day:Is405North:I405HOV           0.932857947258507\n",
       "IsOneStop:Is405North:I405HOV                    0.932857947258507\n",
       "new_fraction_10day:IsOneStop:Is405North:I405HOV 0.932857947258507\n",
       "                                                granularity                      \n",
       "new_fraction_10day                              ride/date/commute [One Stop Only]\n",
       "new_fraction_10day                              ride/date/commute/peak           \n",
       "new_fraction_10day:IsOneStop                    ride/date/commute/peak           \n",
       "new_fraction_10day                              ride/date [first stop, am only]  \n",
       "Is405North:I405HOV                              ride/date [first stop, am only]  \n",
       "new_fraction_10day:I405HOV                      ride/date [first stop, am only]  \n",
       "new_fraction_10day:Is405North                   ride/date [first stop, am only]  \n",
       "new_fraction_10day:Is405North:I405HOV           ride/date [first stop, am only]  \n",
       "new_fraction_10day                              ride/date [first stop, am only]  \n",
       "new_fraction_10day:IsOneStop                    ride/date [first stop, am only]  \n",
       "Is405North:I405HOV                              ride/date [first stop, am only]  \n",
       "new_fraction_10day:Is405North:I405HOV           ride/date [first stop, am only]  \n",
       "IsOneStop:Is405North:I405HOV                    ride/date [first stop, am only]  \n",
       "new_fraction_10day                              ride/date [first stop, am only]  \n",
       "new_fraction_10day:IsOneStop                    ride/date [first stop, am only]  \n",
       "Is405North:I405HOV                              ride/date [first stop, am only]  \n",
       "new_fraction_10day:Is405North:I405HOV           ride/date [first stop, am only]  \n",
       "IsOneStop:Is405North:I405HOV                    ride/date [first stop, am only]  \n",
       "new_fraction_10day:IsOneStop:Is405North:I405HOV ride/date [first stop, am only]  "
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "(TABLE_4 <- do.call(rbind,lapply(TABLE_4_MODELS,function(x)x$coef)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "2"
      ],
      "text/latex": [
       "2"
      ],
      "text/markdown": [
       "2"
      ],
      "text/plain": [
       "[1] 2"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "1 + 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "R",
   "language": "R",
   "name": "ir"
  },
  "language_info": {
   "codemirror_mode": "r",
   "file_extension": ".r",
   "mimetype": "text/x-r-source",
   "name": "R",
   "pygments_lexer": "r",
   "version": "3.5.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
